问题
I installed R with conda
conda install -c r r-essentials
Now I cannot use the Rcpp
library, even so it is installed with r-essentials
. I get the following error:
# using library inline to compile a C++ code on the fly
library(inline)
library(Rcpp)
src <- '
std::vector<std::string> s;
s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
'
hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
cat(hellofun(), '\n')
Error in dyn.load(libLFile): unable to load shared object '/tmp/Rtmp5N7UzX/file3a485578682c.so':
/tmp/Rtmp5N7UzX/file3a485578682c.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_
Traceback:
1. cxxfunction(body = src, includes = "", plugin = "Rcpp", verbose = FALSE)
2. dyn.load(libLFile)
I believe that this also affects compilation of modules not included in conda like rstan
, which installation failed with a similar error.
回答1:
I know this is an old thread, however updating a response I received on Github.
I faced the same error with different package installation (in my case it was BCP). Based on the solution/work around provided here, the error in dyn.load()
is no longer appearing. So it may be worth a try to update the R version using conda update r-essentials
.
来源:https://stackoverflow.com/questions/40333691/unable-to-use-rcpp-after-conda-install