I'm trying to install sf package from source to run it with latest version of geos/gdal/proj which were installed by homebrew. I'm using an Apple Silicon M1 computer with MacOS BigSur 11.3. and it seems that my issues are linked to this new Apple silicon chip. If any of you already faced the issue and could share some tips that'd be great.
Here is my command in R :
install_github("r-spatial/sf", configure.args = c("--with-proj-lib=/opt/homebrew/bin/", "--with-gdal-config=/opt/homebrew/bin/gdal-config", "--with-geos-config=/opt/homebrew/bin/geos-config"))
and the response is
Downloading GitHub repo r-spatial/sf@HEAD
✓ checking for file ‘/private/var/folders/50/g22y7v993hq6m6r4m3mm05_r0000gn/T/Rtmp5KWH5H/remotesc7c51a94ebf/r-spatial-sf-c99226b/DESCRIPTION’ (418ms)
─ preparing ‘sf’:
✓ checking DESCRIPTION meta-information ...
─ cleaning src
─ running ‘cleanup’
─ checking for LF line-endings in source and make files and shell scripts (629ms)
─ checking for empty or unneeded directories
─ building ‘sf_0.9-9.tar.gz’
* installing *source* package ‘sf’ ...
** using staged installation
configure: CC: clang -mmacosx-version-min=10.13
configure: CXX: clang++ -mmacosx-version-min=10.13 -std=gnu++11
configure: gdal-config set to /opt/homebrew/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 3.2.2
checking GDAL version >= 2.0.1... yes
checking for gcc... clang -mmacosx-version-min=10.13
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 clang -mmacosx-version-min=10.13 accepts -g... yes
checking for clang -mmacosx-version-min=10.13 option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -mmacosx-version-min=10.13 -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... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
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
ld: warning: ignoring file /opt/homebrew/Cellar/gdal/3.2.2_4/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-e29770.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/libdap/3.20.7/lib64'
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 ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/sf’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/sf’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/50/g22y7v993hq6m6r4m3mm05_r0000gn/T//Rtmp5KWH5H/filec7c4271077b/sf_0.9-9.tar.gz’ had non-zero exit status
When I try to do the same for rgdal I get the same result. And if I do it with rgeos, I get the similar error:
...
checking geos: linking with libgeos_c... no
checking geos: linking with -L/opt/homebrew/Cellar/geos/3.9.1/lib -lgeos_c -lgeos -lm... no
ld: warning: ignoring file /opt/homebrew/Cellar/geos/3.9.1/lib/libgeos_c.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/geos/3.9.1/lib/libgeos.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
...
I'm a bit new at this so let me know if you need more info. Thanks,