isciences / exactextractr

R package for fast and accurate raster zonal statistics
https://isciences.gitlab.io/exactextractr/
272 stars 26 forks source link

Issues installing on M1 Max MacBook pro #79

Open jhemberger opened 2 years ago

jhemberger commented 2 years ago

Having issues installing the package on my new MacBook running an M1 Max chipset. GEOS is installed on latest version. Installation response from RStudio console below:

install.packages("exactextractr")
Installing package into ‘/Users/jhemberger/Library/R/arm64/4.2/library’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
              binary source needs_compilation
exactextractr  0.7.2  0.8.2              TRUE

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

trying URL 'https://cran.rstudio.com/src/contrib/exactextractr_0.8.2.tar.gz'
Content type 'application/x-gzip' length 623313 bytes (608 KB)
==================================================
downloaded 608 KB

* installing *source* package ‘exactextractr’ ...
** package ‘exactextractr’ successfully unpacked and MD5 sums checked
** using staged installation
configure: exactextractr: 0.8.2
checking for geos-config... /usr/local/bin/geos-config
checking geos-config usability... yes
configure: GEOS version: 3.10.2
checking geos version at least 3.5.0... yes
checking compiling and building against geos_c... no
checking geos: linking with -L/usr/local/Cellar/geos/3.10.2/lib -lgeos_c -lgeos -lm... no
ld: warning: ignoring file /usr/local/Cellar/geos/3.10.2/lib/libgeos_c.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/geos/3.10.2/lib/libgeos.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_finishGEOS_r", referenced from:
      _main in geos_test-6a2447.o
  "_initGEOS_r", referenced from:
      _main in geos_test-6a2447.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure: Compilation and/or linkage problems.
configure: error: initGEOS_r not found in libgeos_c.
ERROR: configuration failed for package ‘exactextractr’
* removing ‘/Users/jhemberger/Library/R/arm64/4.2/library/exactextractr’
Warning in install.packages :
  installation of package ‘exactextractr’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/7g/pd8n9v_s6tv5v8bnnwgk5j9w0000gn/T/RtmpdzBoMv/downloaded_packages’
dbaston commented 2 years ago

It looks like the error message is telling you that you have the x86 version of GEOS installed, not the ARM one.

jhemberger commented 2 years ago

Just re-installed GEOS, and it seems to have installed the arm84 version (Pouring geos--3.10.2.arm64_monterey.bottle.tar.gz). Rebooting Rstudio and trying to reinstall exactextractr to the same issue. 🤷‍♂️