簡體   English   中英

在 LinuxMint 20.1 (Ubuntu 20.04) 上安裝 rgdal 有困難

[英]Difficulty installing rgdal on LinuxMint 20.1 (Ubuntu 20.04)

I am trying to install the R package rgdal on R 4.0.4 on a Linux computer running Linux Mint 20.1 (Ubuntu 20.04). 我收到以下錯誤:

>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 方面不是很有經驗,並嘗試了舊帖子中的東西,但這些都沒有奏效。

您的問題似乎與您安裝的GDAL有關。 一個好的安裝會報告“是”與 --libs 鏈接。 也許您手動安裝了 GDAL,這可能會導致庫文件的非標准位置。 我建議使用 Synaptic 完全卸載/重新安裝 GDAL,然后給 rgdal 另一個 go。 希望這會讓你走得更遠。

rgdal 有很多依賴項。 我不得不安裝我忘記了多少個庫才能最終讓它開心。

您可以使用 Michael 的 PPA 中的 rgdal package 的二進制文件:

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

請參閱CRAN 的 Ubuntu 的自述文件(我們最近更新/縮短/簡化),尤其是最后一節。

需要軟件包 libgdal-dev 和 libproj-dev:

sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM