Error: gdal-config not found

2020-02-07 17:40发布

Please point out the point that I am missing:

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

7条回答
男人必须洒脱
2楼-- · 2020-02-07 17:45

In Ubuntu 18.04

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

In earlier versions (which had apt-get)

sudo apt-get install libgdal-dev

查看更多
放我归山
3楼-- · 2020-02-07 17:57

Read the reference manual.

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

查看更多
时光不老,我们不散
4楼-- · 2020-02-07 18:05

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

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.gz works just fine as you would expect from a CRAN package given all the build-time checks at CRAN.

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

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

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

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

查看更多
啃猪蹄的小仙女
5楼-- · 2020-02-07 18:08

On macOS

brew install gdal

removed the error

gdal-config not found

查看更多
放我归山
6楼-- · 2020-02-07 18:09

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

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

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

Then install rgdal by

install.packages("rgdal")

Load rgdal by

library(rgdal)
查看更多
够拽才男人
7楼-- · 2020-02-07 18:09

Try this on CentOS 6

sudo yum install gdal gdal-python gdal-devel mapserver mapserver-python libxml2 libxml2-python python-lxml python-pip python-devel gcc
查看更多
登录 后发表回答