Opened 2 years ago

Closed 2 years ago

#6073 closed defect (fixed)

2.0.svn compilation error in gdalserver.c

Reported by: saultdon Owned by: warmerdam
Priority: normal Milestone: 1.11.3
Component: default Version:
Severity: blocker Keywords:
Cc:

Description

I checked out the 2.0 branch at revision 29663.

Been getting a compilation error:

gcc -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/port -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/gcore -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/alg -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/ogr -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/ogr/ogrsf_frmts -march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fPIC  -Wall -Wdeclaration-after-statement  -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/frmts/vrt -DOGR_ENABLED -D_FORTIFY_SOURCE=2 -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/port -I/usr/include  -DGDAL_COMPILATION -I/usr/include/json-c -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c -o gdalserver.o gdalserver.c
gdalserver.c: In function ‘CreateSocketAndBindAndListen’:
gdalserver.c:124:21: error: storage size of ‘sHints’ isn’t known
     struct addrinfo sHints;
                     ^
gdalserver.c:126:31: error: invalid application of ‘sizeof’ to incomplete type ‘struct addrinfo’
     memset(&sHints, 0, sizeof(struct addrinfo));
                               ^
gdalserver.c:129:23: error: ‘AI_PASSIVE’ undeclared (first use in this function)
     sHints.ai_flags = AI_PASSIVE;
                       ^
gdalserver.c:129:23: note: each undeclared identifier is reported only once for each function it appears in
gdalserver.c:132:12: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
     nRet = getaddrinfo(NULL, pszService, &sHints, &psResults);
            ^
gdalserver.c:135:48: warning: implicit declaration of function ‘gai_strerror’ [-Wimplicit-function-declaration]
         fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet));
                                                ^
gdalserver.c:135:25: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
         fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet));
                         ^
gdalserver.c:141:39: error: dereferencing pointer to incomplete type ‘struct addrinfo’
          psResultsIter = psResultsIter->ai_next)
                                       ^
gdalserver.c:162:5: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
     freeaddrinfo(psResults);
     ^
gdalserver.c:124:21: warning: unused variable ‘sHints’ [-Wunused-variable]
     struct addrinfo sHints;
                     ^
../GDALmake.opt:579: recipe for target 'gdalserver.o' failed
make[1]: *** [gdalserver.o] Error 1
make[1]: Leaving directory '/tmp/makepkg/gdal-filegdb/src/gdal-2.0/apps'
GNUmakefile:67: recipe for target 'apps-target' failed
make: *** [apps-target] Error 2

Change History (4)

comment:1 Changed 2 years ago by saultdon

Tried compiling from the tarball but get the following error:

gdalserver.c: In function ‘CreateSocketAndBindAndListen’:
gdalserver.c:124:21: error: storage size of ‘sHints’ isn’t known
     struct addrinfo sHints;
                     ^
gdalserver.c:126:31: error: invalid application of ‘sizeof’ to incomplete type ‘struct addrinfo’
     memset(&sHints, 0, sizeof(struct addrinfo));
                               ^
gdalserver.c:129:23: error: ‘AI_PASSIVE’ undeclared (first use in this function)
     sHints.ai_flags = AI_PASSIVE;
                       ^
gdalserver.c:129:23: note: each undeclared identifier is reported only once for each function it appears in
gdalserver.c:132:12: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
     nRet = getaddrinfo(NULL, pszService, &sHints, &psResults);
            ^
gdalserver.c:135:48: warning: implicit declaration of function ‘gai_strerror’ [-Wimplicit-function-declaration]
         fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet));
                                                ^
gdalserver.c:135:25: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
         fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet));
                         ^
gdalserver.c:141:39: error: dereferencing pointer to incomplete type ‘struct addrinfo’
          psResultsIter = psResultsIter->ai_next)
                                       ^
gdalserver.c:162:5: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
     freeaddrinfo(psResults);
     ^
gdalserver.c:124:21: warning: unused variable ‘sHints’ [-Wunused-variable]
     struct addrinfo sHints;
                     ^
chmod a+x gdal-config-inst
g++ -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/port -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/gcore -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/alg -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/ogr -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/ogr/ogrsf_frmts -march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fPIC  -Wall  -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/frmts/vrt -DOGR_ENABLED -D_FORTIFY_SOURCE=2 -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/port -I/usr/include  -DGDAL_COMPILATION -I/usr/include/json-c -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c -o nearblack.o nearblack.cpp
chmod a+x gdal-config
g++ -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/port -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/gcore -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/alg -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/ogr -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/ogr/ogrsf_frmts -march=native -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fPIC  -Wall  -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/frmts/vrt -DOGR_ENABLED -D_FORTIFY_SOURCE=2 -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/port -I/usr/include  -DGDAL_COMPILATION -I/usr/include/json-c -I/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c -o gdalmanage.o gdalmanage.cpp
../GDALmake.opt:579: recipe for target 'gdalserver.o' failed
make[1]: *** [gdalserver.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/tmp/makepkg/gdal-filegdb/src/gdal-2.0.0/apps'
GNUmakefile:67: recipe for target 'apps-target' failed
make: *** [apps-target] Error 2

comment:2 Changed 2 years ago by Even Rouault

IS it the same report as https://lists.osgeo.org/pipermail/gdal-dev/2015-August/042381.html ? Which OS and compiler version ?

comment:3 Changed 2 years ago by saultdon

Hi Even,

That looks like this is related - from what I can see, the errors look similar.

I'm on Arch Linux 64-bit:

% uname -a
Linux archasus 4.1.5-1-ARCH #1 SMP PREEMPT Tue Aug 11 15:41:14 CEST 2015 x86_64 GNU/Linux

And compiler is gcc 5.2.0:

% pacman -Qi gcc                                                                                                                        =95%
Name           : gcc
Version        : 5.2.0-2
...
Last edited 2 years ago by saultdon (previous) (diff)

comment:4 Changed 2 years ago by Even Rouault

Milestone: 1.11.3
Resolution: fixed
Status: newclosed
Version: 2.0.0

Fixed in trunk (r29667), branches/2.0 (r29668) and branches/1.11 (r29669)

Note: See TracTickets for help on using tickets.