[Rcpp-devel] Rcpp/ Boost linking problem

Dirk Eddelbuettel edd at debian.org
Wed Sep 9 23:14:30 CEST 2015

On 9 September 2015 at 17:55, Diego Monteiro wrote:
| Good Evening.
| I am pretty new to this programming universe, but I was given a task to create
| an R/C++ package.
| I am trying to link a third-party library to my R/C++ code using Rcpp 0.12.0 ,
| I have successfully used other third party libraries on my R/C++, but when I
| try to use this one that uses boost my R gives me the following error:
| ** testing if installed package can be loaded
| Error in dyn.load(file, DLLpath = DLLpath, ...) :
|   unable to load shared object '/home/diego/R/x86_64-pc-linux-gnu-library/3.2/
| TesteTerralib/libs/TesteTerralib.so':
|   /home/diego/R/x86_64-pc-linux-gnu-library/3.2/TesteTerralib/libs/
| TesteTerralib.so: undefined symbol: _ZN5boost6system15system_categoryEv
| Error: loading failed
| Execution halted
| ERROR: loading failed

You used parts of Boost that require linking.  In case that was an accident,
rewrite your use of Boost to only use headers. In that case Rcpp and the BH
package make it easy.  If not, read on.
| I have boost 1.59.0 installed, but apparently it could not be linked.
| Searching online I have found that maybe adding the flag -lboost_system to the
| g++ it would work, but I don't know how to add this flag when using RStudio nor
| just R in the terminal. Could anybody tell me what should I do?

These are elementary steps in building a package for -- you would declare
this in src/Makevars. And you then have the added problem of ensuring that
the user of your package actually _has_ Boost libraries to link against. One
typically checks in the configure step

But also consider that 

 i)  none of this is specific to Rcpp, so the question is not really
     approrpriate for this forum.

 ii) this is not exactly newbie material so please talk to whoever gave you
     the task to also ensure you get proper training.

Sorry tp be the bearer of bad news but there is no real way of sugra coating this.


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list