clang -march=native -O2 -pipe -fomit-frame-pointer -fPIC -DHAVE_SSE_AT_COMPILE_TIME -Wall -Wdeclaration-after-statement -DHAVE_GEOS=1 -I/usr/include -I/var/tm p/portage/sci-libs/gdal-1.11.1-r3/work/gdal-1.11.1/port -I/var/tmp/portage/sci-libs/gdal-1.11.1-r3/work/gdal-1.11.1/gcore -I/var/tmp/portage/sci-libs/gdal-1.11. 1-r3/work/gdal-1.11.1/alg -I/var/tmp/portage/sci-libs/gdal-1.11.1-r3/work/gdal-1.11.1/ogr -I/var/tmp/portage/sci-libs/gdal-1.11.1-r3/work/gdal-1.11.1/ogr/ogrsf_ frmts -I/var/tmp/portage/sci-libs/gdal-1.11.1-r3/work/gdal-1.11.1/frmts -DOGR_ENABLED -I/var/tmp/portage/sci-libs/gdal-1.11.1-r3/work/gdal-1.11.1/port -I/usr/ -I/usr//include -c -o gdalserver.o gdalserver.c gdalserver.c:124:21: error: variable has incomplete type 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:126:24: error: invalid application of 'sizeof' to an incomplete type 'struct addrinfo' memset(&sHints, 0, sizeof(struct addrinfo)); ^ ~~~~~~~~~~~~~~~~~ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:129:23: error: use of undeclared identifier 'AI_PASSIVE' sHints.ai_flags = AI_PASSIVE; ^ gdalserver.c:132:12: warning: implicit declaration of function 'getaddrinfo' is invalid in C99 [-Wimplicit-function-declaration] nRet = getaddrinfo(NULL, pszService, &sHints, &psResults); ^ gdalserver.c:135:48: warning: implicit declaration of function 'gai_strerror' is invalid in C99 [-Wimplicit-function-declaration] fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet)); ^ gdalserver.c:135:48: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat] fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(nRet)); ~~ ^~~~~~~~~~~~~~~~~~ %d gdalserver.c:141:39: error: incomplete definition of type 'struct addrinfo' psResultsIter = psResultsIter->ai_next) ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:143:45: error: incomplete definition of type 'struct addrinfo' nListenSocket = socket(psResultsIter->ai_family, ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:144:45: error: incomplete definition of type 'struct addrinfo' psResultsIter->ai_socktype, ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:145:45: error: incomplete definition of type 'struct addrinfo' psResultsIter->ai_protocol); ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:149:46: error: incomplete definition of type 'struct addrinfo' if (bind(nListenSocket, psResultsIter->ai_addr, ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:150:31: error: incomplete definition of type 'struct addrinfo' psResultsIter->ai_addrlen) != SOCKET_ERROR) ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:152:57: error: incomplete definition of type 'struct addrinfo' if( pnFamily ) *pnFamily = psResultsIter->ai_family; ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:153:57: error: incomplete definition of type 'struct addrinfo' if( pnSockType ) *pnSockType = psResultsIter->ai_socktype; ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:154:57: error: incomplete definition of type 'struct addrinfo' if( pnProtocol ) *pnProtocol = psResultsIter->ai_protocol; ~~~~~~~~~~~~~^ gdalserver.c:124:12: note: forward declaration of 'struct addrinfo' struct addrinfo sHints; ^ gdalserver.c:162:5: warning: implicit declaration of function 'freeaddrinfo' is invalid in C99 [-Wimplicit-function-declaration] freeaddrinfo(psResults); ^ 4 warnings and 12 errors generated. ../GDALmake.opt:568: recipe for target 'gdalserver.o' failed make[1]: *** [gdalserver.o] Error 1 make[1]: Leaving directory '/var/tmp/portage/sci-libs/gdal-1.11.1-r3/work/gdal-1.11.1/apps'
This does not appear to be related to the compiler, but perhaps a change in glibc. This report resolves the issue, which seems to have been reported upstream: https://bugzilla.redhat.com/show_bug.cgi?id=1249703 The portage versions are behind upstream releases, but I was able to confirm that gdal-2.0.2 compiles, while gdal-1.11.2 fails in the way reported.
sci-libs/gdal-1.11.x was finally removed from tree.