2012-08-27 15 views
27

Bitte den Punkt darauf hinweisen, dass ich fehle:Fehler: gdal-config nicht gefunden

openSUSE 11,3


[email protected]:~/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’ 

[email protected]:~/Desktop/R> whereis gdal-config 
gdal-config: /usr/local/bin/gdal-config 

[email protected]:~/Desktop/R> gdal-config 
Usage: gdal-config [OPTIONS] 
Options: 
[--prefix[=DIR]] 
[--libs] 
[--dep-libs] 
[--cflags] 
[--datadir] 
[--version] 
[--ogr-enabled] 
[--formats] 
[email protected]:~/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:


[email protected]:~/Desktop/R> gdal-config --version 
1.9.0 

[email protected]:~/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 

Antwort

47

Sie benötigen das -dev Paket mit Kopf- und Shared Library-Links für Entwicklung neben dem normalen Paket für Einsatz. Zwei verschiedene Anwendungsfälle, soweit es die Distribution betrifft.

Auf meiner Verteilung:

[email protected]:/tmp$ dpkg -l | grep gdal | cut -c-72 
ii libgdal1-1.7.0        1.7.3-6ubuntu3   
ii libgdal1-dev         1.7.3-6ubuntu3   
[email protected]:/tmp$ 

und R CMD INSTALL rgdal_0.7-8.tar.gz funktioniert gut, wie Sie von einem CRAN-Paket bei all den Aufbauzeitkontrollen an CRAN erwarten.

-Update Ende 2016: Wie @ JoshO'Brien weist darauf hin, in dem Kommentar

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

Für Ubuntu 16.04 die entsprechende Zeile
wäre sudo apt-get install libgdal1i

Solche Umbenennung von Upstream-Bibliotheken ist üblich; etwas wie apt-cache search libgdal kann helfen, die aktuellen Paketnamen zu finden. Der wichtige Schlüssel ist jedoch, dass das "abstrakte" Entwicklungspaket libgdal-dev alles ist, das benötigt wird, um zu bauen, wie es das "konkrete" gegenwärtige Laufzeitpaket (hier: libgdal1i) über eine Abhängigkeit zieht.

+0

Minor update: Hier im Jahr 2016, unter Ubuntu 14.04.2, scheint 'libgdal1h'' libgdal1' ersetzt zu haben (obwohl 'libgdal1-dev' noch benötigt wird). Zumindest bekomme ich einen Fehler in diesem Sinne, als ich versuchte, 'install-libgdal1' zu installieren. –

4

das Referenzhandbuch lesen.

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/ ;

+0

Ich habe die Version von gdal Config oben hinzugefügt. Ich suche auch nach proj4. Aber bezieht sich proj4 auf "diesen" Fehler? –

+0

Ich habe das Projekt installiert, siehe Bearbeiten. Das Problem besteht immer noch. –

23

Sie können das Paket apt-file verwenden, um herauszufinden, welches Paket die fehlende Datei enthält, nach der Sie suchen.

Zuerst installieren Sie die apt-Datei mit dem Befehl apt-get install apt-file
aktualisieren apt-Datei mit dem Befehl apt-file update
Jetzt können Sie apt-Datei verwenden, um die fehlende Datei zu finden. apt-file search gdal-config

Für meinen Fall, habe ich den gleichen Fehler bei der Konfiguration von Grass-7.1 von Svn.Wie unten gezeigt:

$ ./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. 

Aber nach der Suche nach gdal-config Datei mit apt-Datei wie unten gezeigt, ich war in der Lage, den Fehler zu beheben, nachdem das Paket libgdal1-dev Installation

$ apt-file search gdal-config 

Ergebnisse

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

Also ich installe d libgdal1-dev, wie unten dargestellt:

$ sudo apt-get install libgdal1-dev 
+8

Dies behebt den Fehler, aber ich musste auch 'sudo apt-get install libproj-dev' installieren, um 'rgdal' zu installieren. Siehe http://stackoverflow.com/questions/15248815/rgdal-package-installation – geneorama

+2

Ich kann bestätigen, dass 'libproj-dev' auch benötigt wird. R gibt 'configure: error: proj_api.h not found ...' zurück, ansonsten wie von @geneorama erwähnt. –

+0

Ich bestätige dies, einschließlich des Pakets in den Kommentaren, löste mein Problem für Ubuntu 16.04 und R 3.4. – luchonacho

0

Versuchen Sie dies auf CentOS 6

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