2012-08-27 43 views
27

請你指出我錯過了點:錯誤:@中,配置未發現

的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  
> 

編輯:


[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 

回答

47

您需要-dev包頭文件和共享庫鏈接,發展除了正常的包部署。就發行而言,有兩種不同的用例。

在我的分佈:

[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$ 

R CMD INSTALL rgdal_0.7-8.tar.gz作品就好了,你會從CRAN包期望給所有的編譯時檢查在CRAN。

更新2016晚:如@ JoshO'Brien在評論指出

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

爲Ubuntu 16.04相應的線路將
sudo apt-get install libgdal1i

上游庫的這種重命名是常見的;諸如apt-cache search libgdal之類的東西可以幫助找到當前的軟件包名稱。但關鍵在於「抽象」開發包libgdal-dev是構建所需的全部內容,因爲它通過依賴關係抽取「具體」當前運行時包(此處爲:libgdal1i)。

+0

次要更新:在2016年,運行Ubuntu 14.04.2,'libgdal1h'似乎已經替換了'libgdal1'(儘管仍然需要'libgdal1-dev')。至少我在嘗試「apt-get install libgdal1」時遇到錯誤。 –

4

閱讀參考手冊。

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

我已經加入GDAL配置的版本的上方。我也檢查proj4。但是,proj4與「這個」錯誤有關嗎? –

+0

我已經安裝了proj,請參閱編輯。問題仍然存在。 –

23

您可以使用apt-file軟件包來查找哪個軟件包包含您正在查找的丟失文件。

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

對於我的情況,從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. 

但是,隨着的apt-文件尋找@中,配置文件後,如下圖所示,我能夠解決錯誤,安裝包後libgdal1-dev的

$ apt-file search gdal-config 

結果

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

所以我installe d libgdal1-dev的,如下圖所示:

$ sudo apt-get install libgdal1-dev 
+8

這解決了這個錯誤,但我還必須執行'sudo apt-get install libproj-dev'來安裝'rgdal'。請參閱http://stackoverflow.com/questions/15248815/rgdal-package-installation – geneorama

+2

我可以確認'libproj-dev'也是需要的。 R返回'configure:error:proj_api.h not found ...',否則如@geneorama所述。 –

+0

我確認了這一點,包括評論中的軟件包,解決了我在Ubuntu 16.04和R 3.4上遇到的問題。 – luchonacho

0

嘗試此在CentOS 6

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