RcppCore / RcppEigen

Rcpp integration for the Eigen templated linear algebra library
Other
111 stars 40 forks source link

RcppEigen won't load on RHEL 6 with Devtoolset-6 #46

Closed jjramsey closed 6 years ago

jjramsey commented 6 years ago

I have Devtoolset-6 installed on my RHEL 6 workstation, so that I have access to a relatively newer version of GCC, in this case, version 6.3.1, than I would have otherwise. I successfully compiled and installed R with it. However, installing RcppEigen fails.

I've tried installed RcppEigen in the usual way, via install.packages(), and this is what I get as output:

* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** libs
g++  -I/data/Projects/R/3.4.1/lib64/R/include -DNDEBUG  -I"/data/Projects/R/3.4.1/lib64/R/library/Rcpp/include" -I/data/Projects/R/ExtDeps/Bzip2-1.0.6/include -I/data/Projects/R/ExtDeps/Curl-7.55.1/include -I/data/Projects/R/ExtDeps/Pcre-8.41/include -I/data/Projects/R/ExtDeps/Readline-7.0-master-20170918/include -I/data/Projects/R/ExtDeps/Xz-5.2.3/include -I/data/Projects/R/ExtDeps/Zlib-1.2.11/include  -I../inst/include -fpic  -g -O2  -c RcppEigen.cpp -o RcppEigen.o
g++  -I/data/Projects/R/3.4.1/lib64/R/include -DNDEBUG  -I"/data/Projects/R/3.4.1/lib64/R/library/Rcpp/include" -I/data/Projects/R/ExtDeps/Bzip2-1.0.6/include -I/data/Projects/R/ExtDeps/Curl-7.55.1/include -I/data/Projects/R/ExtDeps/Pcre-8.41/include -I/data/Projects/R/ExtDeps/Readline-7.0-master-20170918/include -I/data/Projects/R/ExtDeps/Xz-5.2.3/include -I/data/Projects/R/ExtDeps/Zlib-1.2.11/include  -I../inst/include -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++  -I/data/Projects/R/3.4.1/lib64/R/include -DNDEBUG  -I"/data/Projects/R/3.4.1/lib64/R/library/Rcpp/include" -I/data/Projects/R/ExtDeps/Bzip2-1.0.6/include -I/data/Projects/R/ExtDeps/Curl-7.55.1/include -I/data/Projects/R/ExtDeps/Pcre-8.41/include -I/data/Projects/R/ExtDeps/Readline-7.0-master-20170918/include -I/data/Projects/R/ExtDeps/Xz-5.2.3/include -I/data/Projects/R/ExtDeps/Zlib-1.2.11/include  -I../inst/include -fpic  -g -O2  -c fastLm.cpp -o fastLm.o
gcc -I/data/Projects/R/3.4.1/lib64/R/include -DNDEBUG  -I"/data/Projects/R/3.4.1/lib64/R/library/Rcpp/include" -I/data/Projects/R/ExtDeps/Bzip2-1.0.6/include -I/data/Projects/R/ExtDeps/Curl-7.55.1/include -I/data/Projects/R/ExtDeps/Pcre-8.41/include -I/data/Projects/R/ExtDeps/Readline-7.0-master-20170918/include -I/data/Projects/R/ExtDeps/Xz-5.2.3/include -I/data/Projects/R/ExtDeps/Zlib-1.2.11/include   -fpic  -g -O2  -c init.c -o init.o
g++ -shared -L/data/Projects/R/3.4.1/lib64/R/lib -L/data/Projects/R/ExtDeps/Bzip2-1.0.6/lib -Wl,-rpath=/data/Projects/R/ExtDeps/Bzip2-1.0.6/lib -L/data/Projects/R/ExtDeps/Curl-7.55.1/lib -Wl,-rpath=/data/Projects/R/ExtDeps/Curl-7.55.1/lib -L/data/Projects/R/ExtDeps/Pcre-8.41/lib -Wl,-rpath=/data/Projects/R/ExtDeps/Pcre-8.41/lib -L/data/Projects/R/ExtDeps/Readline-7.0-master-20170918/lib -Wl,-rpath=/data/Projects/R/ExtDeps/Readline-7.0-master-20170918/lib -L/data/Projects/R/ExtDeps/Xz-5.2.3/lib -Wl,-rpath=/data/Projects/R/ExtDeps/Xz-5.2.3/lib -L/data/Projects/R/ExtDeps/Zlib-1.2.11/lib -Wl,-rpath=/data/Projects/R/ExtDeps/Zlib-1.2.11/lib -o RcppEigen.so RcppEigen.o RcppExports.o fastLm.o init.o -L/data/Projects/R/3.4.1/lib64/R/lib -lRlapack -L/data/Projects/R/3.4.1/lib64/R/lib -lRblas -L/usr/lib/gcc/x86_64-redhat-linux/4.4.4 -lgfortran -lm -L/data/Projects/R/3.4.1/lib64/R/lib -lR
installing to /data/Projects/R/3.4.1/lib64/R/library/RcppEigen/libs
** R
** inst
** preparing 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 ‘RcppEigen’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/data/Projects/R/3.4.1/lib64/R/library/RcppEigen/libs/RcppEigen.so':
  /data/Projects/R/3.4.1/lib64/R/library/RcppEigen/libs/RcppEigen.so: undefined symbol: _ZNSt16invalid_argumentC1EPKc
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/data/Projects/R/3.4.1/lib64/R/library/RcppEigen’

Offhand, it looks like I can successfully compile RcppEigen, but there's some problem in the linking process, so that the library containing invalid_argument (probably std::invalid_argument) isn't being linked to.

dmbates commented 6 years ago

Yes

% c++filt _ZNSt16invalid_argumentC1EPKc
std::invalid_argument::invalid_argument(char const*)
eddelbuettel commented 6 years ago

Sorry to hear you are having troubles, but this strikes me entirely as a local RHEL deployment issue. The code (as shipped) builds fine (on normal systems).

jjramsey commented 6 years ago

Well, I think I discovered the problem, and oddly enough, it seems to have to do with FLIBS. Unless I explicitly set the environment variable F77 to "gfortran", "-L/usr/lib/gcc/x86_64-redhat-linux/4.4.4" will be added to FLIBS, which ends as part of the link line for RcppEigen. I guess that causes the linker to try to link to the wrong libstdc++?