[Rcpp-devel] Linking Rcpp and libcmaes within a package

Marie-Pierre ETIENNE marie.etienne at agroparistech.fr
Fri May 1 18:04:55 CEST 2015


Thanks Dirk for your advice 

----- Mail original -----

De: "Dirk Eddelbuettel" <edd at debian.org> 
À: "Marie-Pierre ETIENNE" <marie.etienne at agroparistech.fr> 
Cc: rcpp-devel at lists.r-forge.r-project.org 
Envoyé: Vendredi 1 Mai 2015 17:33:11 
Objet: Re: [Rcpp-devel] Linking Rcpp and libcmaes within a package 


On 1 May 2015 at 16:12, Marie-Pierre ETIENNE wrote: 
| CXX_STD = CXX11 
| PKG_CPPFLAGS=-I/usr/local/include/libcmaes -I../inst/include -I/usr/local/include/eigen3/ 

If you add LinkingTo: RcppEigen then you don't need the explicit include 
for Eigen3, and are more portable. Of course, you would need our RcppEigen package. 

| PKG_LIBS = -L/usr/local/lib -l cmaes`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` 

A few issues here: 

1) The Rscript call has not been necessary for about 15 months now since 
Rcpp 0.11.0 came out. 

2) The space between -l and cmaes is an error 

3) -L/usr/local/lib is not needed, that is a default directory 

so try just 

PKG_LIBS = -lcmaes 

instead. 


I have tried this but I still have the same error message 
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/metienne/R/x86_64-pc-linux-gnu-library/3.1/testCMaes/libs/testCMaes.so':
  libcmaes.so.0: cannot open shared object file: No such file or directory
Error: loading failed 

And just to be clear: The cmaes library is now a SystemRequirements: -- only 
people who have it will be able to use your package. For that reason some 
people "internalise" such librarie in their package. You need to check if 
you a) are allowed to do that and b) if you want to -- yet more work. 

Yes I am aware of this drawback of using external code. The libcmaes is distributed under LGPLv3 license, so I guess I should be allowed to internalise the library but ... one step at a time. 
Anyway, thanks again for your advice. At least the global framework is cleaner. 

Dirk 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150501/35c0e725/attachment.html>


More information about the Rcpp-devel mailing list