0

Can't install rgdal, sf etc however my necessary libs are installed like gdal, proj, geos.

I do not know what the problem is.

install.packages("rgdal", type = "source") trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.5-32.tar.gz' Content type 'application/x-gzip' length 4469369 bytes (4.3 MB) ================================================== downloaded 4.3 MB

  • installing source package ‘rgdal’ ... ** package ‘rgdal’ successfully unpacked and MD5 sums checked ** using staged installation configure: R_HOME: /Library/Frameworks/R.framework/Resources configure: CC: clang -mmacosx-version-min=10.13 configure: CXX: clang++ -mmacosx-version-min=10.13 -std=gnu++14 configure: CFLAGS: -Wall -g -O2 configure: CPPFLAGS: -I/usr/local/include configure: CXXFLAGS: -Wall -g -O2 configure: LDFLAGS: -L/usr/local/lib configure: LDFLAGS: -L/usr/local/lib configure: CXX11 is: clang++ -mmacosx-version-min=10.13, CXX11STD is: -std=gnu++11 configure: CXX is: clang++ -mmacosx-version-min=10.13 -std=gnu++11 configure: C++11 support available configure: rgdal: 1.5-32 checking for /usr/bin/svnversion... no configure: svn revision: 1176 checking for gdal-config... /opt/homebrew/bin/gdal-config checking gdal-config usability... yes configure: GDAL: 3.5.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 ld: warning: ignoring file /opt/homebrew/Cellar/gdal/3.5.1_2/lib/libgdal.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 Undefined symbols for architecture x86_64: "_GDALAllRegister", referenced from: _main in gdal_test-a23254.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ld: warning: directory not found for option '-L/opt/homebrew/Cellar/libxml2/2.9.14_3/lib' ld: library not found for -lcrypto clang: error: linker command failed with exit code 1 (use -v to see invocation) configure: Install failure: compilation and/or linkage problems. configure: error: GDALAllRegister not found in libgdal. ERROR: configuration failed for package ‘rgdal’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal’

1 Answer 1

0

I just figured out the solution. The problem is with the arm based versions of gdal and etc. When R tries to install these packages they are looking for an intel version (probably the package is not ready and fully compatible with arm).

To solve the issue:

  1. Install rosetta 2
  2. Create a terminal copy in your applications which is going to run with rosetta 2 (you can tick on Terminal - Copy info page)
  3. remove arm based homebrew (also clean folders and junk that is left behind in /opt/homebrew)
  4. install intel based homebrew in the second rosetta terminal (which brew should show /usr/...)
  5. install pkg-config, proj, geos, and gdal with intel based homebrew
  6. restart R and install rgdal and all the gdal based packages you need

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.