【发布时间】:2016-10-30 21:14:40
【问题描述】:
我用 conda 安装了 R
conda install -c r r-essentials
现在我不能使用Rcpp 库,即使它是用r-essentials 安装的。我收到以下错误:
# 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)
我相信这也会影响 conda 中未包含的模块的编译,例如 rstan,安装失败并出现类似错误。
【问题讨论】:
-
你可以试试:
Rcpp::evalCpp("2+2")? -
这给出了同样的错误。
-
请大声而清晰地向 Continuum 投诉,因为它破坏了可靠且有效的 R 设置。但值得一提的是:我们(如在 R 社区,特别是 Rcpp 团队)支持 CRAN 安装。剩下的就靠自己了,也许在 Continuum 的帮助下。