[gdal-dev] SIGPIPE missing due to not including signal.h

Even Rouault even.rouault at spatialys.com
Sun Nov 1 08:51:50 PST 2015


Le dimanche 01 novembre 2015 17:43:35, vous avez écrit :
> I am building on netbsd-6 i386 with gcc 4.5.3.
> 
> I got an error about SIGPIPE being undefined.  The man page says that
> signal.h is required to be included, and posix agrees:
> 
>   http://pubs.opengroup.org/onlinepubs/9699919799/functions/signal.html
> 
> I couldn't find an include of signal.h; the following patch resolves the
> error.

Couldn't you try to include signal.h in gdalserver.c only so as to avoid 
growing cpl_port.h ?

> 
> Index: port/cpl_port.h
> ===================================================================
> --- port/cpl_port.h	(revision 31282)
> +++ port/cpl_port.h	(working copy)
> @@ -125,6 +125,7 @@
>  /*      Standard include files.                                         */
>  /* ==================================================================== */
> 
> +#include <signal.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <math.h>
> 
> 
> 
> gmake[1]: Entering directory '/usr/home/gdt/SOFTWARE/GEO/gdal/apps'
> /bin/ksh /home/gdt/SOFTWARE/GEO/gdal/libtool --mode=compile --tag=CC gcc
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/home/gdt/SOFTWARE/GEO/gdal/gcore
> -I/home/gdt/SOFTWARE/GEO/gdal/alg -I/home/gdt/SOFTWARE/GEO/gdal/ogr
> -I/home/gdt/SOFTWARE/GEO/gdal/ogr/ogrsf_frmts
> -I/home/gdt/SOFTWARE/GEO/gdal/gnm -I/home/gdt/SOFTWARE/GEO/gdal/apps -g
> -O2  -Wall -Wdeclaration-after-statement -Wextra -Winit-self
> -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wformat
> -Werror=format-security -Wno-format-nonliteral -Werror=vla
> -Wdeclaration-after-statement -Wno-clobbered 
> -I/home/gdt/SOFTWARE/GEO/gdal/frmts/vrt -DOGR_ENABLED -I/usr/pkg/include
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/usr/pkg/include  -DGDAL_COMPILATION
> -I/usr/pkg/include/json-c
> -I/home/gdt/SOFTWARE/GEO/gdal/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1
> -I/usr/pkg/include -c -o gdalserver.lo gdalserver.c libtool: compile:  gcc
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/home/gdt/SOFTWARE/GEO/gdal/gcore
> -I/home/gdt/SOFTWARE/GEO/gdal/alg -I/home/gdt/SOFTWARE/GEO/gdal/ogr
> -I/home/gdt/SOFTWARE/GEO/gdal/ogr/ogrsf_frmts
> -I/home/gdt/SOFTWARE/GEO/gdal/gnm -I/home/gdt/SOFTWARE/GEO/gdal/apps -g
> -O2 -Wall -Wdeclaration-after-statement -Wextra -Winit-self
> -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wformat
> -Werror=format-security -Wno-format-nonliteral -Werror=vla
> -Wdeclaration-after-statement -Wno-clobbered
> -I/home/gdt/SOFTWARE/GEO/gdal/frmts/vrt -DOGR_ENABLED -I/usr/pkg/include
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/usr/pkg/include -DGDAL_COMPILATION
> -I/usr/pkg/include/json-c
> -I/home/gdt/SOFTWARE/GEO/gdal/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1
> -I/usr/pkg/include -c gdalserver.c  -fPIC -DPIC -o .libs/gdalserver.o
> gdalserver.c: In function 'RunServer':
> gdalserver.c:428:9: warning: implicit declaration of function 'signal'
> gdalserver.c:428:16: error: 'SIGPIPE' undeclared (first use in this
> function) gdalserver.c:428:16: note: each undeclared identifier is
> reported only once for each function it appears in gdalserver.c:428:25:
> error: 'SIG_IGN' undeclared (first use in this function)
> ../GDALmake.opt:650: recipe for target 'gdalserver.lo' failed
> gmake[1]: *** [gdalserver.lo] Error 1
> gmake[1]: Leaving directory '/usr/home/gdt/SOFTWARE/GEO/gdal/apps'
> GNUmakefile:93: recipe for target 'apps-target' failed
> gmake: *** [apps-target] Error 2

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list