[R] Problems with external library conflict in R package

Pascal A. Niklaus p@@c@|@n|k|@u@ @end|ng |rom |eu@uzh@ch
Thu Oct 31 19:17:38 CET 2019


I have an R library (using Rcpp) that used to compile and install fine. 
It uses some boost libraries. My Makevars file looks like this:

PKG_LIBS=`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` -lboost_iostreams -lm
CXX_STD = CXX14

The problem I face now is that for some other R-independent software 
project I installed boost 1.71 from source in /usr/local. Since then, 
the R package does not install anymore; I get:

Error: package or namespace load failed (...) dyn.load(file, DLLpath = 
DLLpath, ...):
  unable to load shared object (...) XXX.so
  undefined symbol: _ZN5boost9iostreams6detail10bzip2_base3endEbSt9nothrow_t

Both the distribution's includes and library files and the ones I 
installed in /usr/local are there:

$ locate boost/iostreams/filter/bzip2.hpp
/usr/include/boost/iostreams/filter/bzip2.hpp
/usr/local/include/boost/iostreams/filter/bzip2.hpp

$ ldconfig -p | grep boost_ios
         libboost_iostreams.so.1.71.0 (libc6,x86-64) => 
/usr/local/lib/libboost_iostreams.so.1.71.0
         libboost_iostreams.so.1.65.1 (libc6,x86-64) => 
/usr/lib/x86_64-linux-gnu/libboost_iostreams.so.1.65.1

When I als specify -L/usr/local/lib in Makevars, the code installs fine.

There is probably a simple answer, but I don't understand why I get this 
mismatch between library versions. Any help is appreciated!

Thanks

Pascal



More information about the R-help mailing list