Travis CI build error with my R package that uses C++, Rcpp and RcppArmadillo

Drumy

Here is the GitHub repo of my R package

I've been able to install this package from source on Windows, MacOS, and a Linux cluster with devtools::install_github("ntthung/ldsr")

I'm trying to integrate Travis CI and upon build, I get the following error

Error: package or namespace load failed for ‘ldsr’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/tmp/RtmpK7z3X6/Rinst2ef05609c709/00LOCK-ldsr/00new/ldsr/libs/ldsr.so':/tmp/RtmpK7z3X6/Rinst2ef05609c709/00LOCK-ldsr/00new/ldsr/libs/ldsr.so: undefined symbol: dpotrf_

I found that dpotrf_ belongs to a library called libflame. So I made the file Rload.R with te command Sys.setenv("PKG-LIBS"="-llibflame") and added the following to .travis.yml

script:
    - Rscript Rload.R
    - R CMD build . --compact-vignettes=gs+qpdf
    - R CMD check *tar.gz --as-cran

But I still get the same error.

My package uses Rcpp and RcppArmadillo.

Help please! Thanks.

Dirk Eddelbuettel

This looks like the basic error of not having a proper src/Makevars as would have been created from e.g. RcppArmadillo.package.skeleton() and others.

So as a first basic fix attempt, copy in the file inst/skeleton/Makevars from RcppArmadillo which contains

## 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)

You did copy in the Windows variant Makevars.win you just forgot the main one.

And dpotrf_ is a standard LAPACK symbol so the error is an obvious one for more experienced users (and this question is likely a duplicate too). Also, looking at the sources of the 600+ other CRAN packages using RcppArmadillo is often a good idea too -- they are all on GitHub under user cran.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

travis-ci build for r package

Travis CI R package error in documentation

R package dependency error on travis-ci but not local machine

Error when downloading package (which uses RcppArmadillo) via devtools

Memory Error when running my C++ code w/ Rcpp/RcppArmadillo : Can't identify exactly what is wrong after debugging with valgrind

Trouble building R package wtih devtools when it uses RcppArmadillo

Specify valgrind options to R package on Travis CI

Travis-ci C language Build matrix

Error using Travis CI with R package: 'roxygen2' >= 5.0.0 must be installed for this functionality

ERROR: lazy loading failed for package RcppArmadillo on R 3.5.3

Build webpack on travis ci

Travis Ci build error caused by Android SDK license agreements

Travis CI - android build failed. No connected devices error

Travis CI build passing but status bar still showing error

Travis CI build [Cocoapod Swift] fails with no 'such module...' error

travis-ci : error during the build (No such file or directory)

Issue Building R package with RcppArmadillo

Unable to build the RcppArmadillo.package.skeleton test package: Multiple definition of `R_init_<name>'

R package with c++ (without Rcpp)

R Package: Call C Function Within Rcpp

Travis CI - Android Build Script

Travis CI build triggered twice

Travis-CI error: installing nloptr pkg (r pkg check)

Travis CI C++ Build succeed but travis exited with 1 and doesn't passes the test

R package with Rcpp

RcppArmadillo: Error when installing package on Mac

RcppArmadillo sample.h error in package check

Xcodebuild- Travis CI can't archive a project that uses cocoapods due to code signing error?

Linking error of R package with Rcpp: "undefined symbol: LAPACKE_dgels"