Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation with R 3.6.0 #14

Closed
fcocquemas opened this issue Jun 26, 2019 · 6 comments

Comments

@fcocquemas
Copy link

commented Jun 26, 2019

Thanks for the great library! I'm attempting to install on a fresh Mojave install and I ran into some issues compiling. I've found a workaround but I thought this might be helpful to report.

First, I installed R compiler tools on a fresh R 3.6.0 install using the useful guide by @coatless. I get Rcpp (1.0.1) and RcppArmadillo (0.9.500.2.0) to install without issues, and the example compiles and runs just fine. I then installed ArrayFire 3.6.4 using the OSX installer.

For RcppArrayFire, I followed the wiki's instructions:

drat::addRepo("daqana")
install.packages("RcppArrayFire", configure.args = "--with-arrayfire=/opt/arrayfire")

This yields the following error:

* installing *source* package ‘RcppArrayFire’ ...
** using staged installation
checking whether the C++ compiler works... no
configure: error: in `/private/var/folders/tt/3hctlkj56q16vwl_5443sv580000gn/T/RtmpnzllS9/R.INSTALL20306d3a934c/RcppArrayFire':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘RcppArrayFire’
* removing ‘/usr/local/lib/R/3.6/site-library/RcppArrayFire’

I would love to read config.log but it seems to be in the temp folder that gets deleted as the install fails. I don't know of a workaround.

But, I get the same error if I git clone the macos branch of this repository, then install the package using R CMD install --configure-args="--with-arrayfire=/opt/arrayfire" rcpparrayfire. There, I actually get config.log. Here it is:
config.log

It appears that the error has to do with the command R CMD config CXX1X, which is now deprecated and returns:

ERROR: no information for variable 'CXX1X'

This seems to be fixed in the configure and configure.ac for the main branch. I also attempted to git clone the main branch this repository, and the error is quite a bit different:

* installing to library ‘/usr/local/lib/R/3.6/site-library’
* installing *source* package ‘RcppArrayFire’ ...
** using staged installation
checking for R < 3.4.0 for CXX1X flag use... no
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++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... clang++ -std=gnu++11 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether clang++ -std=gnu++11 accepts -g... (cached) yes
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 arrayfire.h usability... yes
checking arrayfire.h presence... yes
checking for arrayfire.h... yes
checking for libaf.so... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/flags.R
** libs
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.0_3/lib/R/include" -DNDEBUG -I../inst/include -I/opt/arrayfire/include  -DSTRICT_R_HEADERS -I"/usr/local/lib/R/3.6/site-library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC  -g -O2  -c RcppArrayFire.cpp -o RcppArrayFire.o
In file included from RcppArrayFire.cpp:23:
In file included from ../inst/include/RcppArrayFire.h:30:
In file included from /usr/local/lib/R/3.6/site-library/Rcpp/include/Rcpp.h:38:
/usr/local/lib/R/3.6/site-library/Rcpp/include/Rcpp/Environment.h:91:24: error: no matching function for call to 'R_lsInternal'
                return R_lsInternal( env, all ? TRUE : FALSE ) ;
                       ^~~~~~~~~~~~
/usr/local/Cellar/r/3.6.0_3/lib/R/include/Rinternals.h:1031:6: note: candidate function not viable: no known conversion from 'int' to
      'Rboolean' for 2nd argument
SEXP R_lsInternal(SEXP, Rboolean);
     ^
In file included from RcppArrayFire.cpp:23:
In file included from ../inst/include/RcppArrayFire.h:31:
../inst/include/RcppArrayFireWrap.h:87:18: warning: enumeration value 'AF_STORAGE_DENSE' not handled in switch [-Wswitch]
        switch ( storage_type ) {
                 ^
../inst/include/RcppArrayFireWrap.h:109:18: warning: enumeration value 'AF_STORAGE_DENSE' not handled in switch [-Wswitch]
        switch ( storage_type ) {
                 ^
2 warnings and 1 error generated.
make: *** [RcppArrayFire.o] Error 1
ERROR: compilation failed for package ‘RcppArrayFire’
* removing ‘/usr/local/lib/R/3.6/site-library/RcppArrayFire’

So, my workaround is to use the macos branch, but replace configure and configure.ac with the ones from the main branch. It compiles and works fine but I'm not sure whether I'm missing out on some other fixes from the main branch.

Thanks again for a fantastic library.

@rstub

This comment has been minimized.

Copy link
Member

commented Jun 27, 2019

Interesting. The configure script from the macos branch is indeed out of date. However, the important changes in the macos branch are (other parts of) the configure script, since I had trouble linking with the generic libaf. The main branch has seen some new developments since then, e.g. sparse matrix support. I will see if I can set-up a development machine for MacOS again.

@rstub rstub added the macos label Jun 27, 2019

rstub added a commit that referenced this issue Jun 27, 2019
@rstub

This comment has been minimized.

Copy link
Member

commented Jun 27, 2019

I can reproduce the error from master and macos branch. However, copying configure from master to macos I get the error

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RcppArrayFire’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rcpparrayfire/00new/RcppArrayFire/libs/RcppArrayFire.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rcpparrayfire/00new/RcppArrayFire/libs/RcppArrayFire.so, 6): Library not loaded: @rpath/libaf.3.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rcpparrayfire/00new/RcppArrayFire/libs/RcppArrayFire.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed

This are the sort of errors that have been plaguing me since I tried to port RcppArrayFire to MacOS. I find it fascinating that it does not occur for you. As a workaround, I am now adding/opt/arrayfire/lib to @rpath.

@rstub

This comment has been minimized.

Copy link
Member

commented Jun 27, 2019

I have updated the macos branch such that it can be installed without having to borrow the configure script from the master branch. Now I will have to find out, why current master does not build on MacOS.

@fcocquemas

This comment has been minimized.

Copy link
Author

commented Jun 27, 2019

Nice, thank you! I can confirm the macos branch now compiles and installs on my machine without changes.

I've had a number of issues with macOS and Xcode/CLT compiler versions, Makevars going away, and so on... Partly why I did a clean install. The guide that @coatless wrote was so helpful.

Your error looks like it might be related to staged install in R 3.6.0:
https://stackoverflow.com/questions/56365021/hisafer-installation-how-do-i-solve-hard-coded-installation-path

@rstub rstub closed this in 04c50e7 Jun 28, 2019

@rstub

This comment has been minimized.

Copy link
Member

commented Jun 28, 2019

Thanks for pushing me to look into this again. In the end all that was needed was handling of a few conflicts while merging ...

@fcocquemas

This comment has been minimized.

Copy link
Author

commented Jun 28, 2019

My pleasure, thank you for maintaining this library! It's made my code a couple of orders of magnitude faster!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.