2015-05-19 8 views
5

Ich habe versucht, rgdal mit configure.args zu installieren, aber kein Glück.rgdal in ubuntu 14.04 nicht installieren können (undefiniert, um auf 'pj_ctx_fclose' zu verweisen)

installiert gdal Version:

gdal-config --version 
1.11.2 

ogrinfo --version 
GDAL 1.11.2, released 2015/02/10 

gefunden gdal binäre Werkzeuge:

ls /usr/bin | grep gdal 
gdal2tiles.py 
gdal2xyz.py 
gdaladdo 
gdal_auth.py 
gdalbuildvrt 
gdal_calc.py 
gdalchksum.py 
gdalcompare.py 
gdal-config 
gdal_contour 
gdaldem 
gdal_edit.py 
gdalenhance 
gdal_fillnodata.py 
gdal_grid 
gdalident.py 
gdalimport.py 
gdalinfo 
gdallocationinfo 
gdalmanage 
gdal_merge.py 
gdalmove.py 
gdal_polygonize.py 
gdal_proximity.py 
gdal_rasterize 
gdal_retile.py 
gdalserver 
gdal_sieve.py 
gdalsrsinfo 
gdaltindex 
gdaltransform 
gdal_translate 
gdalwarp 

gefunden proj Header-Dateien:

ls /usr/include | grep proj 
libprojectM 
libprojectM-qt 
org_proj4_Projections.h 
proj_api.h 
projects.h 

gefunden proj lib Dateien:

ls /usr/lib | grep proj 
libproj.a 
libprojectM-qt.so 
libprojectM-qt.so.1 
libprojectM-qt.so.1.10 
libprojectM.so 
libprojectM.so.2 
libprojectM.so.2.1.0 
libproj.la 
libproj.so 
libproj.so.0 
libproj.so.0.7.0 

installierten Pakete über gdal:

dpkg -l | grep gdal 
ii gdal-bin            1.11.2+dfsg-1~exp2~trusty       amd64  Geospatial Data Abstraction Library - Utility programs 
ii libgdal-dev           1.11.2+dfsg-1~exp2~trusty       amd64  Geospatial Data Abstraction Library - Development files 
ii libgdal1-dev           1.11.2+dfsg-1~exp2~trusty       all   Geospatial Data Abstraction Library - Transitional package 
ii libgdal1h            1.11.2+dfsg-1~exp2~trusty       amd64  Geospatial Data Abstraction Library 
ii python-gdal           1.11.2+dfsg-1~exp2~trusty       amd64  Python bindings to the Geospatial Data Abstraction Library 

dpkg -l | grep proj 
ii libgeo-proj4-perl          1.05-1            amd64  PROJ.4 library for cartographic projections 
ii libproj-dev           4.8.0-2ubuntu2          amd64  Cartographic projection library (development files) 
ii libproj0            4.8.0-2ubuntu2          amd64  Cartographic projection library 
ii libprojectm-dev          2.1.0+dfsg-1build2         amd64  Advanced Milkdrop-compatible music visualization library - dev 
ii libprojectm-qt-dev         2.1.0+dfsg-1build2         amd64  projectM Qt4 (development files) 
ii libprojectm-qt1          2.1.0+dfsg-1build2         amd64  projectM Qt4 bindings 
ii libprojectm2           2.1.0+dfsg-1build2         amd64  Advanced Milkdrop-compatible music visualization library 
ii proj-bin            4.8.0-2ubuntu2          amd64  Cartographic projection library (tools) 
ii proj-data            4.8.0-2ubuntu2          amd64  Cartographic projection filter and library (datum package) 
ii projectm-data           2.1.0+dfsg-1build2         all   Advanced Milkdrop-compatible music visualization library - data 
ii xfwm4             4.11.1-2ubuntu2          amd64  window manager of the Xfce project 

install.packages('rgdal',type='source', 
        configure.args = paste('--with-gdal-config=/usr/bin/gdal-config', 
             '--with-proj-lib=/usr/lib', 
             '--with-proj-include=/usr/include')) 
Installing package into ‘/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2’ 
(as ‘lib’ is unspecified) 
trying URL 'http://mirrors.ustc.edu.cn/CRAN/src/contrib/rgdal_0.9-2.tar.gz' 
Content type 'application/gzip' length 1627386 bytes (1.6 MB) 
================================================== 
downloaded 1.6 MB 

* installing *source* package ‘rgdal’ ... 
** package ‘rgdal’ successfully unpacked and MD5 sums checked 
configure: CC: gcc -std=gnu99 
configure: CXX: g++ 
configure: rgdal: 0.9-2 
checking for /usr/bin/svnversion... no 
configure: svn revision: 526 
configure: gdal-config set to /usr/bin/gdal-config 
checking gdal-config exists... yes 
checking gdal-config executable... yes 
checking gdal-config usability... yes 
configure: GDAL: 1.11.2 
checking GDAL version >= 1.6.3... yes 
checking GDAL version < 2... yes 
checking for gcc... gcc -std=gnu99 
checking whether the C compiler works... yes 
checking for C compiler default output file name... a.out 
checking for suffix of executables... 
checking whether we are cross compiling... no 
checking for suffix of object files... o 
checking whether we are using the GNU C compiler... yes 
checking whether gcc -std=gnu99 accepts -g... yes 
checking for gcc -std=gnu99 option to accept ISO C89... none needed 
checking how to run the C preprocessor... gcc -std=gnu99 -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /bin/grep -E 
checking for ANSI C header files... yes 
checking for sys/types.h... yes 
checking for sys/stat.h... yes 
checking for stdlib.h... yes 
checking for string.h... yes 
checking for memory.h... yes 
checking for strings.h... yes 
checking for inttypes.h... yes 
checking for stdint.h... yes 
checking for unistd.h... yes 
checking gdal.h usability... yes 
checking gdal.h presence... yes 
checking for gdal.h... yes 
checking gdal: linking with --libs only... yes 
checking GDAL: /usr/share/gdal/1.11/pcs.csv readable... yes 
checking proj_api.h usability... yes 
checking proj_api.h presence... yes 
checking for proj_api.h... yes 
checking for pj_init_plus in -lproj... yes 
configure: PROJ.4 version: > 4.8.0 
/tmp/ccsGVxP9.o: In function `main': 
/tmp/RtmpOqwz92/R.INSTALL23317ae38fc4/rgdal/proj_conf_test.c:20: undefined reference to `pj_ctx_fclose' 
collect2: error: ld returned 1 exit status 
./configure: line 3735: ./proj_conf_test: No such file or directory 
checking PROJ.4: epsg found and readable... yes 
/tmp/ccaNfCUo.o: In function `main': 
/tmp/RtmpOqwz92/R.INSTALL23317ae38fc4/rgdal/proj_conf_test.c:20: undefined reference to `pj_ctx_fclose' 
collect2: error: ld returned 1 exit status 
./configure: line 3810: ./proj_conf_test: No such file or directory 
checking PROJ.4: conus found and readable... yes 
configure: Package CPP flags: -I/usr/include/gdal -I/usr/include 
configure: Package LIBS: -L/usr/lib -lgdal -L/usr/lib -lproj 
configure: creating ./config.status 
config.status: creating src/Makevars 
** libs 
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c OGR_write.cpp -o OGR_write.o 
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal-bindings.cpp -o gdal-bindings.o 
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o 
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c local_stubs.c -o local_stubs.o 
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_geom.cpp -o ogr_geom.o 
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_polygons.c -o ogr_polygons.o 
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_proj.cpp -o ogr_proj.o 
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogrdrivers.cpp -o ogrdrivers.o 
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogrsource.cpp -o ogrsource.o 
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c projectit.cpp -o projectit.o 
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rgdal.so OGR_write.o gdal-bindings.o init.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o -L/usr/lib -lgdal -L/usr/lib -lproj -L/usr/lib/R/lib -lR 
installing to /home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs 
** R 
** data 
** inst 
** preparing package for lazy loading 
** help 
*** installing help indices 
** building package indices 
** installing vignettes 
** testing if installed package can be loaded 
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
    unable to load shared object '/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so': 
    /home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so: undefined symbol: pj_ctx_fgets 
Error: loading failed 
Execution halted 
ERROR: loading failed 
* removing ‘/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal’ 
Warning in install.packages : 
    installation of package ‘rgdal’ had non-zero exit status 

EDIT: Ich habe versucht, install.packages ('rgdal') ohne configure.args. Ich habe den gleichen Fehler. Jetzt tring ich rgdal mit einem kompilierten Projekt 4.9.1 installieren und LD_LIBRARY_PATH zu proj 4.9.1 exportieren. Leider ist es wieder fehlgeschlagen. Hier ist meine neue script.sh:

export LD_LIBRARY_PATH=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/lib:/usr/lib:$LD_LIBRARY_PATH 

sudo R CMD REMOVE rgdal 

R CMD INSTALL rgdal_0.9-2.tar.gz --byte-compile --configure-args='--with-gdal-config=/usr/bin/gdal-config --with-proj-lib=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/lib --with-proj-include=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/include --with-proj-share=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/share/proj' 

Alles ist in Ordnung aber nicht bei der Prüfung:

installing to /home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs 
** R 
** data 
** inst 
** byte-compile and prepare package for lazy loading 
** help 
*** installing help indices 
** building package indices 
** installing vignettes 
** testing if installed package can be loaded 
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
    unable to load shared object '/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so': 
    /home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so: undefined symbol: pj_ctx_fgets 
Error: loading failed 
Execution halted 
ERROR: loading failed 
* removing ‘/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal’ 

aktualisieren: Schließlich habe ich sovled dieses Problem. Erstens, Entfernen von proj4-4.8 durch apt-get.

sudo apt-get remove libproj-dev 

Zweitens meine kompilierte proj4-4.9 lib Pfad in eine neue conf-Datei (wie rgdal.conf) Zugabe unter dem Pfad von ‚/etc/ld.so.conf.d/‘.

cd /etc/ld.so.conf.d 
sudo touch rgdal.conf 
echo 'the lib path of proj4-4.9' | sudo tee -a rgdal.conf 

Und dann die Installation rgdal mit configure.args die kompilierte lib Pfad von proj4-4.9 verweisen.

export LD_LIBRARY_PATH=the lib path of proj4-4.9:$LD_LIBRARY_PATH 

sudo R CMD REMOVE rgdal 

R CMD INSTALL rgdal_0.9-2.tar.gz --byte-compile --configure-args='--with-gdal-config=/usr/bin/gdal-config --with-proj-lib=compiled path of proj4-4.9/lib --with-proj-include=compiled path of proj4-4.9/include --with-proj-share=compiled path of proj4-4.9/share/proj' 

Im Moment ist alles in Ordnung. Aber ich konnte keine Version von rgdal mit proj4-4.8 und default configure.args installieren. Ich habe bereits Dateien von proj4 nach dem Vorschlag von @Pascal geputzt. Ich bin mir also nicht sicher über den genauen Grund dieses Problems.

+0

Brauchen Sie wirklich 'configure.args'? Erforderliche Header scheinen in gemeinsamen Verzeichnissen installiert zu sein ('/ usr/include','/usr/lib' und so weiter). Hast du auch einen anderen Spiegel benutzt? –

+0

Ich habe install.packages ('rgdal') ohne configure.args versucht. Ich habe den gleichen Fehler. Ich versuche, rgdal mit einem kompilierten Projekt 4.9 zu installieren und LD_LIBRARY_PATH nach Projekt 4.9 zu exportieren. Leider ist es wieder fehlgeschlagen. –

+1

Dies könnte hilfreich sein: https://stat.ethz.ch/pipermail/r-sig-geo/2012-May/014973.html. Möglicherweise tritt ein Problem auf, wenn Sie mehrere installierte Versionen von proj haben. –

Antwort

1

Schließlich habe ich dieses Problem gelöst. Erstens, Entfernen von proj4-4.8 durch apt-get.

sudo apt-get remove libproj-dev 

Zweitens meine kompilierte proj4-4.9 lib Pfad in eine neue conf-Datei (wie rgdal.conf) Zugabe unter dem Pfad von ‚/etc/ld.so.conf.d/‘.

cd /etc/ld.so.conf.d 
sudo touch rgdal.conf 
echo 'the lib path of proj4-4.9' | sudo tee -a rgdal.conf 

Und dann die Installation rgdal mit configure.args die kompilierte lib Pfad von proj4-4.9 verweisen.

export LD_LIBRARY_PATH=the lib path of proj4-4.9:$LD_LIBRARY_PATH 

sudo R CMD REMOVE rgdal 

R CMD INSTALL rgdal_0.9-2.tar.gz --byte-compile --configure-args='--with-gdal-config=/usr/bin/gdal-config --with-proj-lib=compiled path of proj4-4.9/lib --with-proj-include=compiled path of proj4-4.9/include --with-proj-share=compiled path of proj4-4.9/share/proj' 

Im Moment ist alles in Ordnung. Aber ich konnte keine Version von rgdal mit proj4-4.8 und default configure.args installieren. Ich habe bereits Dateien von proj4 nach dem Vorschlag von @Pascal geputzt. Ich bin mir also nicht sicher über den genauen Grund dieses Problems.

3

Haben Sie libgdal-dev und libproj-dev installiert?

Im Terminal:

sudo apt-get update && sudo apt-get install libgdal-dev libproj-dev 

Dann in R versuchen und rgdal erneut zu installieren.

+0

Ja, gdal 1.11.2 und proj4 4.8.0 werden von apt-get installiert. –

+0

Und ich kann diese mit dem Befehl 'dpkg -l | sicherstellen grep gdal 'und' dpkg -l | Grep proj '. Die installierten Pakete sind in meiner Frage aufgelistet. –

+0

Also hast du proj.4 4,8 und 4,9 installiert? –