微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 LinuxMint 20.1 (Ubuntu 20.04) 上安装 rgdal 有困难

如何解决在 LinuxMint 20.1 (Ubuntu 20.04) 上安装 rgdal 有困难

我正在尝试在运行 Linux Mint 20.1 (Ubuntu 20.04) 的 Linux 计算机上的 R 4.0.4 上安装 R 包 rgdal。我收到以下错误

>install.packages('rgdal')

Installing package into ‘/home/brant/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rgdal_1.5-23.tar.gz'
Content type 'application/x-gzip' length 4393536 bytes (4.2 MB)
==================================================
downloaded 4.2 MB

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
** using staged installation
configure: R_HOME: /usr/lib/R
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
configure: CFLAGS: -g -O2 -fdebug-prefix-map=/build/r-base-fhxXXR/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
configure: CPPFLAGS: 
configure: CXXFLAGS: -g -O2 -fdebug-prefix-map=/build/r-base-fhxXXR/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
configure: LDFLAGS: -Wl,-Bsymbolic-functions -Wl,-z,relro
configure: LDFLAGS: -Wl,relro
configure: CXX11 is: g++,CXX11STD is: -std=gnu++11
configure: CXX is: g++ -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.5-23
checking for /usr/bin/svnversion... no
configure: svn revision: 1121
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.2.1
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
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libgeos-3.9.0.so: undefined reference to `std::runtime_error::runtime_error(std::runtime_error&&)@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so.1: undefined reference to `std::__cxx11::basic_stringstream<char,std::char_traits<char>,std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so.1: undefined reference to `__cxa_init_primary_exception@CXXABI_1.3.11'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so.1: undefined reference to `std::thread::_State::~_State()@GLIBCXX_3.4.22'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so.1: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,std::default_delete<std::thread::_State> >,void (*)())@GLIBCXX_3.4.22'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so.1: undefined reference to `std::__exception_ptr::exception_ptr::exception_ptr(void*)@CXXABI_1.3.11'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libgeos-3.9.0.so: undefined reference to `std::runtime_error::runtime_error(std::runtime_error&&)@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libdap.so.25: undefined reference to `std::logic_error::logic_error(std::logic_error&&)@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so.1: undefined reference to `typeinfo for std::thread::_State@GLIBCXX_3.4.22'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/libgdal.so: undefined reference to `std::__cxx11::basic_ostringstream<char,std::allocator<char> >::basic_ostringstream()@GLIBCXX_3.4.26'
collect2: error: ld returned 1 exit status
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libgeos-3.9.0.so: undefined reference to `std::runtime_error::runtime_error(std::runtime_error&&)@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so: undefined reference to `std::__cxx11::basic_stringstream<char,std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so: undefined reference to `__cxa_init_primary_exception@CXXABI_1.3.11'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so: undefined reference to `std::thread::_State::~_State()@GLIBCXX_3.4.22'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,void (*)())@GLIBCXX_3.4.22'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so: undefined reference to `std::__exception_ptr::exception_ptr::exception_ptr(void*)@CXXABI_1.3.11'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libgeos-3.9.0.so: undefined reference to `std::runtime_error::runtime_error(std::runtime_error&&)@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libdap.so: undefined reference to `std::logic_error::logic_error(std::logic_error&&)@GLIBCXX_3.4.26'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/x86_64-linux-gnu/libheif.so: undefined reference to `typeinfo for std::thread::_State@GLIBCXX_3.4.22'
/home/linuxbrew/.linuxbrew/bin/ld: /usr/lib/libgdal.so: undefined reference to `std::__cxx11::basic_ostringstream<char,std::allocator<char> >::basic_ostringstream()@GLIBCXX_3.4.26'
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’
* removing ‘/home/brant/R/x86_64-pc-linux-gnu-library/4.0/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpyhzVNG/downloaded_packages’

有人对正在发生的事情以及如何解决有任何建议吗?我在 Linux 方面的经验不是很丰富,我尝试过旧帖子中的东西,但这些都没有奏效。

解决方法

您的问题似乎与您的 GDAL 安装有关。一个好的安装会报告“是”链接--libs。也许您手动安装了 GDAL,这最终会导致库文件的位置不标准。我建议使用 Synaptic 完全卸载/重新安装 GDAL,然后再给 rgdal 一个机会。 希望这能让您走得更远。

rgdal 有很多依赖项。我不得不安装 I-forget-how-many 库才能最终让它开心。

,

您可以使用 Michael 的 PPA 中的 rgdal 包的二进制文件:

$ apt-cache policy r-cran-rgdal
r-cran-rgdal:
  Installed: (none)
  Candidate: 1.5-23-1cran1.2004.0
  Version table:
     1.5-23-1cran1.2004.0 500
        500 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal/main amd64 Packages
     1.5-12-1 500
        500 http://us.archive.ubuntu.com/ubuntu groovy/universe amd64 Packages
$ 

请参阅 README for Ubuntu at CRAN(我们最近更新/缩短/简化),尤其是最后一部分。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。