sf icon indicating copy to clipboard operation
sf copied to clipboard

Problems installing sf (for Monocle3); M1 Pro MacBook

Open garrett-lam opened this issue 1 year ago • 2 comments

Describe the bug

  • I followed the instructions to download have gdal downloaded but unable to download sf aftewards
  • SAME bug with install.packages("sf")

To Reproduce

install.packages("sf", configure.args = "--with-proj-lib=/usr/local/lib/") OR install.packages("sf")

There is a binary version available but the source version is later: binary source needs_compilation sf 1.0-7 1.0-8 TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes installing the source package ‘sf’

trying URL 'https://cran.rstudio.com/src/contrib/sf_1.0-8.tar.gz' Content type 'application/x-gzip' length 3472914 bytes (3.3 MB)

downloaded 3.3 MB

  • installing source package ‘sf’ ... ** package ‘sf’ successfully unpacked and MD5 sums checked ** using staged installation configure: CC: clang -mmacosx-version-min=10.13 configure: CXX: clang++ -mmacosx-version-min=10.13 -std=gnu++11 checking for gdal-config... /opt/homebrew/bin/gdal-config checking gdal-config usability... yes configure: GDAL: 3.5.1 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.5.1_1/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-882da5.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/poppler/22.06.0_1/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 ‘sf’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/sf’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/sf’ Warning in install.packages : installation of package ‘sf’ had non-zero exit status

The downloaded source packages are in ‘/private/var/folders/89/g3h_xtg92b725qqgg7b883sr0000gn/T/Rtmpl092so/downloaded_packages’

> sessionInfo() R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Monterey 12.0.1

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] BiocManager_1.30.18

loaded via a namespace (and not attached): [1] compiler_4.2.1 tools_4.2.1

garrett-lam avatar Aug 05 '22 20:08 garrett-lam

ld: symbol(s) not found for architecture x86_64 suggests that you have upstream components for the wrong architecture. See the section on binary installs in https://cran.r-project.org/web/views/Spatial.html, there is little difference in this case unless you need to work with new GDAL drivers.

rsbivand avatar Aug 05 '22 21:08 rsbivand

This may or may not help, but when you have

Do you want to install from sources the package which needs compilation? (Yes/no/cancel)

Choose no and see if the slightly older version works.

If you don't get the choice again, remove the package (RStudio -> packages, click on the x by SF) and then reinstall.

nickbearman avatar Aug 27 '22 11:08 nickbearman