r - Travis CI 使用我的使用 C++、Rcpp 和 RcppArmadillo 的 R 包构建错误
问题描述
这是我的R 包的 GitHub 存储库
我已经能够在 Windows、MacOS 和 Linux 集群上从源代码安装这个包devtools::install_github("ntthung/ldsr")
我正在尝试集成 Travis CI,并在构建时收到以下错误
错误:dyn.load(文件,DLLpath = DLLpath,...)中“ldsr”的包或命名空间加载失败:无法加载共享对象“/tmp/RtmpK7z3X6/Rinst2ef05609c709/00LOCK-ldsr/00new/ldsr/libs/ ldsr.so':/tmp/RtmpK7z3X6/Rinst2ef05609c709/00LOCK-ldsr/00new/ldsr/libs/ldsr.so:未定义符号:dpotrf_
我发现它dpotrf_
属于一个名为libflame
. 所以我Rload.R
用 te 命令制作了文件Sys.setenv("PKG-LIBS"="-llibflame")
并将以下内容添加到.travis.yml
script:
- Rscript Rload.R
- R CMD build . --compact-vignettes=gs+qpdf
- R CMD check *tar.gz --as-cran
但我仍然得到同样的错误。
我的包使用 Rcpp 和 RcppArmadillo。
请帮忙!谢谢。
解决方案
这看起来像是没有正确的基本错误,src/Makevars
就像从eg RcppArmadillo.package.skeleton()
和其他人创建的那样。
因此,作为第一次基本修复尝试,从 RcppArmadillo 复制文件inst/skeleton/Makevars,其中包含
## With R 3.1.0 or later, you can uncomment the following line to tell R to
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider
## availability of the package we do not yet enforce this here. It is however
## recommended for client packages to set it.
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
您确实复制了 Windows 变体Makevars.win
,只是忘记了主要的变体。
并且dpotrf_
是一个标准的 LAPACK 符号,因此对于更有经验的用户来说,这个错误是一个明显的错误(这个问题也可能是重复的)。此外,使用 RcppArmadillo 查看 600 多个其他 CRAN 包的来源通常也是一个好主意——它们都在 GitHub 上的 user 下cran
。
推荐阅读
- c - C - 读取文件并打印到文件后获取无效字符,-也许-缓冲区溢出
- html - 一个 autocomplete="off" 示例有效,我的代码 autocomplete="off" 没有?
- c# - 按连接度划分的图
- python - 使用 Pandas 读取嵌套 JSON 的 KeyError
- javascript - 使用 JavaScript 连接数组中的连续(相关)对象
- colors - 终端 emacs 内的曝光颜色
- scheme - 计算多个子列表方案中的元素数
- python - 从稀疏数组有效地计算成对 Jaccard 相似度
- c - 当递归函数在c中达到高深度时停止递归函数
- powershell - 用蛋糕可以轻松完成什么家务,但使用 Powershell + MSBuild 却很痛苦?