问题
On my linux cluster, I am having trouble recompiling R packages that need to be recompiled
with the removal of libRcpp.so
in the latest release. The end goal is
to get the R package DEseq2 running. We have installed a new version
of g++ in /opt/bin
directory have new libraries in /opt/lib64
. I have
also created .R/Makevars
that has these directives:
CXX=/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64
-Wl,-llibstdc++ CC=/opt/bin/c++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++
SHLIB_OPENMP_CXXFLAGS= -fopenmp
"Various versions of Makevars fail, this is just my latest attempt to
overcome a loader problem of it not finding libstdc++ when it links
armadillo. As you can see, it is looking in /usr/lib64
instead of
/opt/lib64
. It is as if my -Wl
directives are ignored. I am
running R as sudo.
Also my .bashrc has:
LD_LIBRARY_PATH=/opt/lib64:/opt/lib64/R/library/Rcpp/libs:$LD_LIBRARY_PATH:~/lib:~/perl/lib:~/lib/bamtools
LD_RUN_PATH=/opt/lib64:$LD_RUN_PATH:~/lib
export LD_LIBRARY_PATH
export LD_RUN_PATH
Here is what I get when I try to compile in R the new packages needing recompilation:
install.packages(onCRAN, lib=lib, repos=rep)
trying URL 'http://cran.rstudio.com/src/contrib/RcppArmadillo_0.4.000.2.tar.gz'
Content type 'application/x-gzip' length 892941 bytes (872 Kb)
opened URL
==================================================
downloaded 872 Kb
* installing *source* package âRcppArmadilloâ ...
** package âRcppArmadilloâ successfully unpacked and MD5 sums checked
* checking LAPACK_LIBS divide-and-conquer complex SVD unavailable via R-supplied LAPACK
* divide-and-conquer algorithm for complex SVD will be redirected to default
** libs
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -I/opt/lib64/R/include -DNDEBUG -I/usr/local/include -I"/opt/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppArmadillo.cpp -o RcppArmadillo.o
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -I/opt/lib64/R/include -DNDEBUG -I/usr/local/include -I"/opt/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -I/opt/lib64/R/include -DNDEBUG -I/usr/local/include -I"/opt/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c fastLm.cpp -o fastLm.o
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/opt/lib64/R/library/Rcpp/libs/Rcpp.so':
/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/lib64/R/library/Rcpp/libs/Rcpp.so)
Calls: ::: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -shared -L/usr/local/lib64 -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -L/opt/lib64/R/lib -lRlapack
-L/opt/lib64/R/lib -lRblas -lgfortran -lm
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/opt/lib64/R/library/Rcpp/libs/Rcpp.so':
/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/lib64/R/library/Rcpp/libs/Rcpp.so)`
Calls: ::: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
/usr/bin/ld: cannot find -llibstdc++
collect2: error: ld returned 1 exit status
make: *** [RcppArmadillo.so] Error 1
ERROR: compilation failed for package âRcppArmadilloâ
* removing â/opt/lib64/RcppArmadilloâ
The downloaded source packages are in
/tmp/RtmpZty35f/downloaded_packages
Warning message:
In install.packages(onCRAN, lib = lib, repos = rep) :
installation of package RcppArmadillo had non-zero exit code
回答1:
Two quick comments:
The definition of
CXX
inCXX=/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64
is a little, ahem, unusual as it mixes linker instructions (for theld
binary). I would try again without.The errors in compiling RcppArmadillo make little sense, it should try to load
libRcpp.so
. And'GLIBCXX_3.4.9' not found
suggests that you may have a path setup.
I would try a simpler setup, fewer bells and whistles, and then work from the inside out: Rebuild / reinstall Rcpp, then RcppArmadillo and so on. It works for a lot of people using more standard setups.
来源:https://stackoverflow.com/questions/21597018/r-recompile-packages-failing-because-failing