Ubuntu 16.04 LTS 上的 GDAL 安裝失敗

Ubuntu 16.04 LTS 上的 GDAL 安裝失敗

我正在嘗試在 Ubuntu 16.04 上安裝 GDAL 2.0。

這是我正在嘗試的命令序列:

sudo apt-get build-dep gdal
cd /tmp 
wget http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz 
tar -xzvf gdal-2.0.0.tar.gz
cd gdal-2.0.0
./configure
make

此時它會失敗並出現錯誤「sHints 的儲存大小未知」:

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.lo' failed
make[1]: *** [gdalserver.lo] Error 1
make[1]: Leaving directory '/tmp/gdal-2.0.0/apps'
GNUmakefile:67: recipe for target 'apps-target' failed
make: *** [apps-target] Error 2

我已經用谷歌搜尋並遵循了迄今為止我能想到的每一條建議,包括安裝了 20 多個我懷疑我是否需要的軟體包。我./configure --with-python也嘗試過。注意:我之前能夠在 Ubuntu 14.04 上成功安裝 GDAL 2.0。

答案1

我發現2.0.0有bug,需要安裝2.1.0。我剛剛交換了版本號,效果很好!

相關內容