Linux 错误:找不到 gdal-config

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12141422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 14:11:14  来源:igfitidea点击:

Error: gdal-config not found

linuxrinstallationgdal

提问by Aquarius_Girl

Please point out the point that I am missing:

请指出我遗漏的一点:

openSUSE 11.3

openSUSE 11.3



anisha@linux-y3pi:~/Desktop/R> sudo R CMD INSTALL rgdal_0.7-12.tar.gz 
root's password:
* installing to library ‘/usr/lib64/R/library'
* installing *source* package ‘rgdal' ...
** package ‘rgdal' successfully unpacked and MD5 sums checked
configure: gdal-config: gdal-config
checking gdal-config usability... ./configure: line 1353: gdal-config: command not found
no
Error: gdal-config not found
The gdal-config script distributed with GDAL could not be found.
If you have not installed the GDAL libraries, you can
download the source from  http://www.gdal.org/
If you have installed the GDAL libraries, then make sure that
gdal-config is in your path. Try typing gdal-config at a
shell prompt and see if it runs. If not, use:
 --configure-args='--with-gdal-config=/usr/local/bin/gdal-config'
with appropriate values for your installation.

ERROR: configuration failed for package ‘rgdal'
* removing ‘/usr/lib64/R/library/rgdal'


anisha@linux-y3pi:~/Desktop/R> whereis gdal-config
gdal-config: /usr/local/bin/gdal-config

anisha@linux-y3pi:~/Desktop/R> gdal-config 
Usage: gdal-config [OPTIONS]
Options:
 [--prefix[=DIR]]
 [--libs]
 [--dep-libs]
 [--cflags]
 [--datadir]
 [--version]
 [--ogr-enabled]
 [--formats]
 anisha@linux-y3pi:~/Desktop/R>


> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> 

Edit:

编辑:



anisha@linux-y3pi:~/Desktop/R> gdal-config --version
1.9.0

anisha@linux-y3pi:~/Desktop/R> proj
Rel. 4.8.0, 6 March 2012
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]


linux-y3pi:~ # $PATH
bash: /home/anisha/qtsdk-2010.05/qt/bin/:/home/anisha/qtsdk-2010.05/bin:/home/anisha/qtsdk-2010.05/qt/bin:/home/anisha/qtsdk-2010.05/qt/bin/:/home/anisha/qtsdk-2010.05/bin:/usr/lib64/mpi/gcc/openmpi/bin:/home/anisha/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games: No such file or directory

采纳答案by Dirk Eddelbuettel

You need the -devpackage with headers and shared library links for developmentbesides the normal package for deployment. Two different use cases as far as the distro is concerned.

你需要的-dev包报头和共享库链接,开发除了正常的包部署。就发行版而言,有两种不同的用例。

On my distribution:

在我的发行版中:

edd@max:/tmp$ dpkg -l | grep gdal | cut -c-72
ii  libgdal1-1.7.0                                1.7.3-6ubuntu3        
ii  libgdal1-dev                                  1.7.3-6ubuntu3        
edd@max:/tmp$ 

and R CMD INSTALL rgdal_0.7-8.tar.gzworks just fine as you would expect from a CRAN package given all the build-time checks at CRAN.

R CMD INSTALL rgdal_0.7-8.tar.gz鉴于 CRAN 上的所有构建时检查,并且正如您对 CRAN 包所期望的那样工作正常。

Update late 2016:As @JoshO'Brien points out in the comment

2016 年末更新:正如@JoshO'Brien 在评论中指出的那样

Minor update: Here in 2016, running Ubuntu 14.04.2, libgdal1hseems to have replaced libgdal1(though libgdal1-devis still needed). At least I get an error to that effect when I attempted to apt-get install libgdal1

次要更新:在 2016 年,运行 Ubuntu 14.04.2 的版本libgdal1h似乎已被替换libgdal1(尽管libgdal1-dev仍然需要)。至少当我尝试这样做时,我得到了一个错误apt-get install libgdal1

For Ubuntu 16.04 the corresponding line would be
sudo apt-get install libgdal1i

对于 Ubuntu 16.04,相应的行是
sudo apt-get install libgdal1i

Such renaming of upstream libraries is common; something such as apt-cache search libgdalcan help locate the current package names. The importantkey though is that the "abstract" development package libgdal-devis all that is needed to build as it pulls the "concrete" current run-time package (here: libgdal1i) in via a dependency.

上游库的这种重命名很常见;诸如此类的东西apt-cache search libgdal可以帮助定位当前的包名称。但是,重要的关键是“抽象”开发包libgdal-dev是构建所需的全部,因为它libgdal1i通过依赖项拉入“具体”当前运行时包(此处:)。

回答by Roland

Read the reference manual.

阅读参考手册。

SystemRequirements for building from source: GDAL >= 1.6.0 library from http://trac.osgeo.org/gdal/wiki/DownloadSourceand PROJ.4 (proj >= 4.4.9) from http://trac.osgeo.org/proj/;

从源代码构建的系统要求:来自http://trac.osgeo.org/gdal/wiki/DownloadSource 的GDAL >= 1.6.0 库和来自http://trac.osgeo 的PROJ.4 (proj >= 4.4.9) 。组织/项目/

回答by Erick

You can use apt-filepackage, to find which package contains the missing file you are looking for.

您可以使用apt-file包来查找包含您要查找的丢失文件的包。

First install the apt-fileusing the command apt-get install apt-file
Update apt-fileusing the command apt-file update
Now you can use apt-fileto find the missing file. apt-file search gdal-config

首先安装的apt-文件使用命令apt-get install apt-file
更新的apt-文件使用命令apt-file update
现在你可以使用的apt-文件找到丢失的文件。apt-file search gdal-config

For my case, I got the same error when configuring grass-7.1 from svn. As shown below:

就我而言,从 svn 配置grass-7.1 时我遇到了同样的错误。如下所示:

    $ ./configure
    ...more...
    checking whether to use GDAL... yes
    checking for gdal-config... /usr/bin/gdal-config
                  ...more....
    ./configure: 1: ./configure: /usr/bin/gdal-config: not found
    ./configure: 6093: test: =: unexpected operator
    configure: error: *** Unable to locate GDAL library.

But, after looking for gdal-configfile with apt-fileas shown below, I was able to resolve the error, after installing the package libgdal1-dev

但是,在使用apt-file查找gdal-config文件后,如下所示,在安装软件包libgdal1-dev后,我能够解决该错误

$ apt-file search gdal-config

Results

结果

libgdal1-dev: /usr/bin/gdal-config

So I installed libgdal1-dev, as shown below:

所以我安装了libgdal1-dev,如下图:

$ sudo apt-get install libgdal1-dev

回答by Wesam Na

Try this on CentOS 6

在 CentOS 6 上试试这个

sudo yum install gdal gdal-python gdal-devel mapserver mapserver-python libxml2 libxml2-python python-lxml python-pip python-devel gcc

回答by Gayan Kavirathne

In Ubuntu 18.04

在 Ubuntu 18.04 中

I fixed this by sudo apt install libgdal-devHope someone find this helpful. Some above answers seems to be outdated and lengthy.

我修复了这个sudo apt install libgdal-dev希望有人觉得这有帮助。上面的一些答案似乎已经过时且冗长。

In earlier versions (which had apt-get)

在早期版本中(有 apt-get)

sudo apt-get install libgdal-dev

sudo apt-get install libgdal-dev

回答by Athira Ramachandran

This happens because the configuration failed for package ‘rgdal' so we have to install necessary dependencies.

发生这种情况是因为包“rgdal”的配置失败,因此我们必须安装必要的依赖项。

The packages libgdal-dev and libproj-dev are required:

需要软件包 libgdal-dev 和 libproj-dev:

sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

Then install rgdal by

然后通过安装 rgdal

install.packages("rgdal")

Load rgdal by

加载 rgdal

library(rgdal)

回答by lhaferkamp

On macOS

macOS 上

brew install gdal

brew install gdal

removed the error

删除了错误

gdal-config not found

找不到 gdal-config