【问题标题】:Difficulty installing rgdal on LinuxMint 20.1 (Ubuntu 20.04)在 LinuxMint 20.1 (Ubuntu 20.04) 上安装 rgdal 有困难
【发布时间】:2021-06-23 08:22:30
【问题描述】:

我正在尝试在运行 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,-Bsymbolic-functions -Wl,-z,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::char_traits<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::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: 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, std::default_delete<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::char_traits<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 方面不是很有经验,并尝试过旧帖子中的一些东西,但这些都没有奏效。

【问题讨论】:

    标签: r linux-mint ubuntu-20.04 rgdal


    【解决方案1】:

    您可以使用 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(我们最近更新/缩短/简化了),尤其是最后一节。

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 2021-02-25
        • 2017-11-07
        • 2020-06-11
        • 2019-10-20
        • 2011-06-04
        • 1970-01-01
        • 2021-07-31
        • 2021-07-03
        • 2021-08-23
        相关资源
        最近更新 更多