GDAL 在 Ubuntu 16.04 LTS 上安装失败

GDAL 在 Ubuntu 16.04 LTS 上安装失败

我正在尝试在 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

我已经在 Google 上搜索并遵循了迄今为止我能找到的所有建议,包括安装 20 多个我怀疑自己是否需要的软件包。我./configure --with-python也试过了。注意:我之前能够在 Ubuntu 14.04 上成功安装 GDAL 2.0。

答案1

我发现 2.0.0 有一个错误,我需要安装 2.1.0。我只需交换版本号,它就可以正常工作!

相关内容