在 R 中安装 rgdal 库时出错:

在 R 中安装 rgdal 库时出错:

我正在努力安装 terra。为了完整起见,我尝试了我在谷歌上找到的所有提示,但没有任何改变这个错误消息。如果我理解得好的话,我需要 rgdal 作为“terra”依赖项,但当我尝试安装 terra 或 rgdal 时,我收到了相同的消息。我尝试过卸载、重新安装、通过 pip、通过 conda 安装,但都不起作用。我非常绝望。gdal 是通过 brew 安装的: gdal-config --version给出3.5.0

R 中的日志:

> install.packages("terra")
Installation du package dans ‘/home/col1/R/x86_64-pc-linux-gnu-library/4.2’
(car ‘lib’ n'est pas spécifié)
essai de l'URL 'https://cloud.r-project.org/src/contrib/terra_1.5-34.tar.gz'
Content type 'application/x-gzip' length 667829 bytes (652 KB)
==================================================
downloaded 652 KB

* installing *source* package ‘terra’ ...
** package ‘terra’ correctement décompressé et sommes MD5 vérifiées
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /home/linuxbrew/.linuxbrew/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.5.0
checking GDAL version >= 2.0.1... yes
checking for gcc... gcc
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 accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/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... no
checking GDAL: linking with --libs and --dep-libs... no
/home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/gdal/3.5.0_1/lib/libgdal.so: undefined reference to `opj_decoder_set_strict_mode'
/home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/gdal/3.5.0_1/lib/libgdal.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/gdal/3.5.0_1/lib/libgdal.so: undefined reference to `opj_encoder_set_extra_options'
collect2: error: ld returned 1 exit status
/home/linuxbrew/.linuxbrew/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/gdal/3.5.0_1/lib/libgdal.so: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
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 ‘terra’
* removing ‘/home/col1/R/x86_64-pc-linux-gnu-library/4.2/terra’
Warning in install.packages :
  l'installation du package ‘terra’ a eu un statut de sortie non nul
Les packages source téléchargés sont dans
    ‘/tmp/RtmpaCYwto/downloaded_packages’

如果有人知道的话,我会非常感激,

相关内容