hunzikp / velox

https://hunzikp.github.io/velox/
119 stars 23 forks source link

Failed to install on Mac #30

Closed thiagoveloso closed 5 years ago

thiagoveloso commented 6 years ago

When trying to install the package on my MacBook Pro, I get the following error:

> install_github("hunzikp/velox")
Downloading GitHub repo hunzikp/velox@master
from URL https://api.github.com/repos/hunzikp/velox/zipball/master
Installing velox
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/_z/01gg71zs19g816v6m2dddt8w0000gn/T/RtmpuyMPbb/devtools55ad1309c763/hunzikp-velox-ff7bc3c'  \
  --library='/Users/thiago/Documents/R-packages' --install-tests 

* installing *source* package ‘velox’ ...
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c aggregate.cpp -o aggregate.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c boostgeom.cpp -o boostgeom.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c coordinates.cpp -o coordinates.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c focal.cpp -o focal.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c hittest.cpp -o hittest.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c im2col.cpp -o im2col.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c median.cpp -o median.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c pointextract.cpp -o pointextract.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c rasterize.cpp -o rasterize.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Users/thiago/Documents/R-packages/Rcpp/include" -I"/Users/thiago/Documents/R-packages/BH/include" -I/usr/local/include   -fPIC  -Wall -g -O2 -c write_helper.cpp -o write_helper.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o velox.so RcppExports.o aggregate.o boostgeom.o coordinates.o focal.o hittest.o im2col.o median.o pointextract.o rasterize.o write_helper.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/thiago/Documents/R-packages/velox/libs
** R
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘velox’ in .doLoadActions(where, attach):
 error in load action .__A__.1 for package velox: Rcpp::loadModule(module = "BOOSTGEOM", what = TRUE, env = ns, : Unable to load module "BOOSTGEOM": vector is too large
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/thiago/Documents/R-packages/velox’
Installation failed: Command failed (1)

If I install it from CRAN, I get the same error when loading it.

Any ideas on what can be wrong? My session info below:

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/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] devtools_1.13.6     gridExtra_2.3       rasterVis_0.45      latticeExtra_0.6-28 RColorBrewer_1.1-2  lattice_0.20-35     raster_2.6-7       
[8] sp_1.3-1           

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18       git2r_0.23.0       pillar_1.3.0       compiler_3.5.1     class_7.3-14       tools_3.5.1        digest_0.6.15     
 [8] memoise_1.1.0      gtable_0.2.0       tibble_1.4.2       lubridate_1.7.4    jsonlite_1.5       viridisLite_0.3.0  pkgconfig_2.0.1   
[15] rlang_0.2.1        rstudioapi_0.7     DBI_1.0.0          curl_3.2           yaml_2.2.0         rgdal_1.3-4        parallel_3.5.1    
[22] hexbin_1.27.2      geojson_0.2.0      geojsonio_0.6.0    spData_0.2.9.3     e1071_1.7-0        withr_2.1.2        jqr_1.0.0         
[29] stringr_1.3.1      httr_1.3.1         hms_0.4.2          rgeos_0.3-28       geojsonlint_0.2.0  classInt_0.2-3     grid_3.5.1        
[36] jsonvalidate_1.0.0 sf_0.6-3           R6_2.2.2           foreign_0.8-71     readr_1.1.1        magrittr_1.5       rmapshaper_0.4.0  
[43] units_0.6-0        maptools_0.9-3     V8_1.5             stringi_1.2.4      lazyeval_0.2.1     crayon_1.3.4       zoo_1.8-3         
pascaloettli commented 6 years ago

Hi,

It probably won't help you, as your configuration and mine are quite different, but I was able to successfully install velox on macOS High Sierra. Here is my R sessionInfo():

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin17.7.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS/LAPACK: /usr/local/Cellar/openblas/0.3.3/lib/libopenblasp-r0.3.3.dylib

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

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

loaded via a namespace (and not attached):
[1] compiler_3.5.1

As you can see, it is an Homebrew installation, with openBLAS (brew install R --with-openblas)

I used the macOS R Toolchain. This makes sure R to use supported compiler (clang4) and writes a customized ~/.R/Makevars.

I also installed the GDAL Framework instead of gdal provided by Homebrew, while I installed geos and proj via Homebrew. To be sure gdal-config is found, one needs to echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile.

Hope this might help.

thiagoveloso commented 6 years ago

@pascaloettli, thanks for your hint. I already had all the requirements working well, at least apparently, my only issue was trying to install velox.

Can you please paste the contents of your ~/.R/Makevars file?

Mine currently looks like this (using Macports compilers):

# Check out some configurations options at this StackOverflow discussion:
# https://stackoverflow.com/questions/43597632/understanding-the-contents-of-the-makevars-file-in-r-macros-variables-r-ma/43599233#43599233

# Macports' GCC
CC=/opt/local/bin/gcc
CXX=/opt/local/bin/g++
C11=/opt/local/bin/g++

# Macports' gfortran
F77=/opt/local/bin/gfortran
FC=/opt/local/bin/gfortran
FLIBS=-L/opt/local/lib/gcc7
pascaloettli commented 6 years ago

@thiagoveloso Here it is:

CPPFLAGS = -I/Library/Frameworks/GTK+.framework/Versions/2.24.X11/Resources/include/gtk-2.0/ -I/opt/X11/include/
# CFLAGS = -g -O3
CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++
CXX1X=/usr/local/clang4/bin/clang++
CXX98=/usr/local/clang4/bin/clang++
CXX11=/usr/local/clang4/bin/clang++
CXX14=/usr/local/clang4/bin/clang++
CXX17=/usr/local/clang4/bin/clang++
LDFLAGS=-L/usr/local/clang4/lib
  # The following statement changes the Fortran linking path
  FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0
  # End Fortran linking path statement
pascaloettli commented 5 years ago

@thiagoveloso Does it work?

thiagoveloso commented 5 years ago

@thiagoveloso Does it work?

Yes, it does! I just had to point out my Macports' GCC compiler to the CXX1X,CXX98,CXX11,CXX14,CXX17 variables and the package compiled fine (after throwing quite a few warnings though).

My Makevars file looks like this now:

# Macports' GCC
CC=/opt/local/bin/gcc
CXX=/opt/local/bin/g++
C11=/opt/local/bin/g++
CXX1X=/opt/local/bin/g++
CXX98=/opt/local/bin/g++
CXX11=/opt/local/bin/g++
CXX14=/opt/local/bin/g++
CXX17=/opt/local/bin/g++

# Macports' gfortran
F77=/opt/local/bin/gfortran
FC=/opt/local/bin/gfortran
FLIBS=-L/opt/local/lib/gcc7

Thanks for the hint, @pascaloettli!