1

I tried to install rgdal package in R on my Mac machine, but the error message came out as below:

Installing package into ‘/Users/isong/Library/R/4.0/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘rgdal’ ...
** using staged installation
configure: R_HOME: /usr/local/lib/R
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
configure: CFLAGS: -g -O2
configure: CPPFLAGS: -I/usr/local/include
configure: CXXFLAGS: -g -O2
configure: LDFLAGS: -L/usr/local/lib
configure: LDFLAGS: -L/usr/local/lib
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-19
checking for /usr/bin/svnversion... no
cat: inst/SVN_VERSION: No such file or directory
configure: svn revision: 
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.0.2
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking GDAL: linking with --libs only... yes
checking GDAL: gdal-config data directory readable... yes
checking GDAL: /usr/local/share/gdal/stateplane.csv readable... yes
configure: pkg-config proj not available
  set PKG_CONFIG_PATH to the directory containing proj.pc
configure: PROJ version not determined using pkg-config proj
configure: PROJ CPP flags:  -I/usr/local/include
configure: PROJ LIBS:  -lproj
checking PROJ header API:... yes
configure: API to be used as yet undetermined, searching ...
configure: Using API: proj.h
checking whether the C++ compiler works... yes

[truncated]

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 proj.h usability... yes
checking proj.h presence... yes
checking for proj.h... yes
checking for proj_context_create in -lproj... yes
checking Using GDAL < 3 with PROJ >= 6... no
checking PROJ version >= 4.8.0... yes
checking PROJ: proj.db found and readable... yes
configure: Package CPP flags:  -I/usr/local/include -DPROJ_H_API
configure: Package LIBS:  -L/usr/local/lib -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs

[truncated]

installing to /Users/isong/Library/R/4.0/library/00LOCK-rgdal/00new/rgdal/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/isong/Library/R/4.0/library/00LOCK-rgdal/00new/rgdal/libs/rgdal.so':
  dlopen(/Users/isong/Library/R/4.0/library/00LOCK-rgdal/00new/rgdal/libs/rgdal.so, 6): Library not loaded: @rpath/libproj.19.dylib
  Referenced from: /Users/isong/Library/R/4.0/library/00LOCK-rgdal/00new/rgdal/libs/rgdal.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/isong/Library/R/4.0/library/rgdal’
* restoring previous ‘/Users/isong/Library/R/4.0/library/rgdal’

For your reference, I already configured and installed libproj, gdal, and geos in my machine and all of the dynamic libraries are located in /usr/local/lib.

Thank you.

Felix Song
  • 21
  • 4
  • Have you tried installing the binary version: `install.packages(rgdal, type="binary")` – Dave2e Nov 28 '20 at 21:12
  • @Dave2e I'm using a ARM64 Mac machine, so there is no binary package available. I hope I had a binary for ARM64 Mac. – Felix Song Dec 02 '20 at 13:40

0 Answers0