Setting up Travis CI on Linux with an R package that uses RcppArmadillo

Travis CI works for macOS. AppVeyor works on Windows.

But Travis CI fails on Linux.

Could I please ask if you might have any tips or hints?

Here's the error I get:

** testing if installed package can be loaded from temporary location

9088Error: package or namespace load failed for ‘harmony’ in dyn.load(file, DLLpath = DLLpath, ...):

9089 unable to load shared object '/tmp/RtmpFJPXav/Rinst331e36a01374/00LOCK-harmony/00new/harmony/libs/':

9090 /tmp/RtmpFJPXav/Rinst331e36a01374/00LOCK-harmony/00new/harmony/libs/ undefined symbol: dgesv_

I already tried adding apt-get dependencies, but that didn't work.

This doesn't work:

       - python-scipy

This also doesn't work:

      - libblas-dev
      - liblapack-dev

The missing symbol dgesv_ is from BLAS/LAPACK. However, the additional dependencies cannot help since R already includes the necessary infrastructure to work with them, c.f. LAPACK_LIBS and BLAS_LIBS in In harmony's master branch this is (sort of[1]) correct. However, in your ci branch you have removed the configure script without moving src/ to src/Makevars. In effect, R tries to install your package without a Makevars file. Therefore LAPACK and BLAS are not present in PKG_LIBS, leading to the missing symbol. You have to decide whether you want a configure script to create src/Makevars from src/ or use a handcrafted src/Makevars.

One further note: You might want to $(SHLIB_OPENMP_CXXFLAGS) to PKG_CXXFLAGS and PKG_LIBS, c.f. the skeleton Makevars.

[1] I find it strange that FLIBS is being overwritten. No idea why this should be necessary.

1 Like

Ralf, thank you! Your advice is making sense.

However, I find that installation on macOS fails when I have this in src/Makevars:

clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o RcppExports.o harmony.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [] Error 1
ERROR: compilation failed for package ‘harmony’

I find that macOS has no problem with installation when the src/Makevars is empty.

So, it seems that I may need to have one Makevars for macOS, and a different Makevars for Linux.

I'm still scratching my head about how to get this right.

Could I please ask if you know the right way to do this?

Ralf, I think I figured it out thanks to your helpful comment.

I deleted the src/Makevars file.

Then I added this in ./configure:

if [ $(uname) == "Linux" ]
  echo 'CXX_STD = CXX11' > ./src/Makevars
  echo 'PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)' >> ./src/Makevars

And now Travis CI is happy for macOS and Linux! :tada:

This indicates that you are not using the gfortran version available from CRAN: I see two possible solutions:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.