在 ubuntu 18.04 上安装 rgdal

install rgdal on ubuntu 18.04

我正在尝试在 Ubuntu 18.04 上安装 rgdal。

我现在收到的错误信息是:

configure: R_HOME: /usr/lib/R
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.4-4
checking for /usr/bin/svnversion... no
configure: svn revision: 833
checking for gdal-config... /home/kchen/anaconda3/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.3.3
checking C++11 support for GDAL >= 2.3.0... yes
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking gdal: linking with --libs only... no
checking gdal: linking with --libs and --dep-libs... no
/usr/lib/x86_64-linux-gnu/libdapserver.so.7: undefined reference to `uuid_generate@UUID_1.0'
/usr/lib/x86_64-linux-gnu/libdapserver.so.7: undefined reference to `uuid_unparse@UUID_1.0'
collect2: error: ld returned 1 exit status
/home/kchen/anaconda3/lib/libcurl.so: undefined reference to `SSL_CTX_set_ciphersuites@OPENSSL_1_1_1'
/home/kchen/anaconda3/lib/libcurl.so: undefined reference to `SSL_CTX_set_post_handshake_auth@OPENSSL_1_1_1'
/home/kchen/anaconda3/lib/libcurl.so: undefined reference to `SSL_CTX_set_keylog_callback@OPENSSL_1_1_1'
collect2: error: ld returned 1 exit status
configure: Install failure: compilation and/or linkage problems.
configure: error: GDALAllRegister not found in libgdal.
ERROR: configuration failed for package ‘rgdal’

在尝试在 R

中安装 'rgdal' 之前,我做了以下操作
$ sudo apt-get upgrade libgdal-dev
$ sudo apt-get upgrade libproj-dev
$ sudo apt-get upgrade gdal-bin

不确定我还应该尝试什么。提前致谢!

您首先必须安装依赖库。 R 也必须 >3.3.0。

sudo apt-get install libgdal1-dev libproj-dev

如果这不起作用,请确保您安装了 C++

g++: command not found

从控制台安装 R-Packages 也是一个更好的解决方案,而不是在 R 内部,因为机器上的每个用户都可以访问该包。否则它只会在您的个人图书馆中。

sudo su - -c "R -e \"install.packages('rgdal', repos='http://cran.rstudio.com/')\""