swift-lang / swift-t

Swift/T: High Performance Parallel Scripting Language
http://swift-lang.org/Swift-T
Apache License 2.0
53 stars 22 forks source link

Spack R fix from Ozik #171

Closed j-woz closed 5 years ago

j-woz commented 5 years ago

From @jozik

j-woz commented 5 years ago

Handling R.home('include') here. CC @ncollier

j-woz commented 5 years ago

The R header could be in: /usr/share/R/include (APT) R_HOME/lib/R/include (source build) ... others?

ncollier commented 5 years ago

Tested this on Ubuntu 18.04 with R installed via apt and R integration enabled with:

 # Enable R integration
ENABLE_R=1
# R_INSTALL is the directory returned in R by R.home()
# R_INSTALL=/path/to/R
# Define these if Rcpp and RInside are not autodetected
# RCPP_INSTALL=/path/to/Rcpp
# RINSIDE_INSTALL=/path/to/RInside

The non-standard location for R.h is found:

checking for /usr/lib/R/include/R.h... no
Using R include: /usr/share/R/include

But it looks like the include for this header file is missing when compiling src/tcl/r/rinside-adapter.C

  CXX       src/tcl/r/rinside-adapter.C
mpicxx -c -o src/tcl/r/rinside-adapter.o  -g -Wall -O1 -fPIC  -I . -I src/turbine -I src/tcl/turbine -I src/tcl/static-pkg/ -I /usr/include/mpi -I /home/nick/sfw/swift-t-171/lb/include -I /home/nick/sfw/swift-t-171/c-utils/include -I/home/nick/anaconda3/include -I/home/nick/anaconda3/include/python3.6m -I /usr/lib/R/include -I /home/nick/R/x86_64-pc-linux-gnu-library/3.4/RInside/include -I /home/nick/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include src/tcl/r/rinside-adapter.C
In file included from /home/nick/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include/RcppCommon.h:29:0,
                 from /home/nick/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include/Rcpp.h:27,
                 from /home/nick/R/x86_64-pc-linux-gnu-library/3.4/RInside/include/RInsideCommon.h:38,
                 from /home/nick/R/x86_64-pc-linux-gnu-library/3.4/RInside/include/RInside.h:26,
                 from src/tcl/r/rinside-adapter.h:14,
                 from src/tcl/r/rinside-adapter.C:4:
/home/nick/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include/Rcpp/r/headers.h:52:10: fatal error: R.h: No such file or directory
 #include <R.h>
          ^~~~~
compilation terminated.
src/tcl/r/module.mk:13: recipe for target 'src/tcl/r/rinside-adapter.o' failed
j-woz commented 5 years ago

That is what is returned for R.home('include') -- amazing...

j-woz commented 5 years ago

Actually R.home('include') was correct, the Makefile was wrong.

j-woz commented 5 years ago

Try 472d49f61

ncollier commented 5 years ago

That did the trick. Compiled and simple R test worked.

j-woz commented 5 years ago

Merged to master.