Travis CI 使用 C++、Rcpp 和 RcppArmadillo 的 R 包构建错误

Dru*_*umy 1 r rcpp travis-ci rcpparmadillo

这是我的R 包的 GitHub 存储库

我已经能够在 Windows、MacOS 和 Linux 集群上从源代码安装这个包 devtools::install_github("ntthung/ldsr")

我正在尝试集成 Travis CI,并且在构建时出现以下错误

错误:dyn.load(file, 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
Run Code Online (Sandbox Code Playgroud)

但我仍然得到同样的错误。

我的包使用 Rcpp 和 RcppArmadillo。

请帮忙!谢谢。

Dir*_*tel 5

这看起来像是没有正确的基本错误,因为它是src/Makevarseg 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)
Run Code Online (Sandbox Code Playgroud)

您确实复制了Makevars.win您忘记主要版本的 Windows 变体。

并且dpotrf_是标准的 LAPACK 符号,因此对于更有经验的用户来说,这个错误很明显(这个问题也可能是重复的)。此外,使用 RcppArmadillo 查看 600 多个其他 CRAN 包的来源通常也是一个好主意——它们都在 GitHub 上的 user 下cran

  • @Drumy:我很高兴这有帮助,但_它仍然是错误的_。每个 RcppArmadillo 包都应该包含上面的三行,只需复制“src/Makevars”即可自动获取它,而不需要手动“Sys.setenv()”。我会重新考虑,和/或测试从新的 `RcppArmadillo.package.sculpture("quickTest")` 开始。 (2认同)