Error al instalar la biblioteca rgdal en R:

Error al instalar la biblioteca rgdal en R:

Estoy teniendo problemas con la instalación de Terra. Para completar, probé todos los consejos que encontré en Google, pero nada cambia este mensaje de error. Necesito rgdal como dependencia 'terra' si lo entiendo bien, pero recibo el mismo mensaje cuando intento instalar terra o rgdal. Intenté desinstalar, reinstalar e instalar mediante pip, mediante conda, pero nada funciona. Estoy bastante desesperada. gdal se instala mediante brew: gdal-config --versionproporciona3.5.0

Inicia sesión en 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’

Si alguien tiene una idea, se lo agradecería mucho.

información relacionada