[Rcpp-devel] Packaging - and even more packaging

Simon Zehnder szehnder at uni-bonn.de
Sun Feb 3 21:41:42 CET 2013

Dear Rcpp-Devels,

maybe you have an answer for me as packaging is a little new for me:

I took the NLopt library (http://ab-initio.mit.edu/wiki/index.php/NLopt) and installed it into a subfolder /nlopt-2.3 in my package-/src folder. The library depends on a header nlopt.hpp and a static library libnlopt.a. 

My Makervars in the /src-folder looks like this (using RcppArmadillo):

PKG_CPPFLAGS = -Inlopt-2.3/include -g -O1
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -Lnlopt-2.3/lib/libnlopt.a

When I call R CMD INSTALL /MCpkgArmadillo I get 

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkgArmadillo/libs/MCpkgArmadillo.so':
  /rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkgArmadillo/libs/MCpkgArmadillo.so: undefined symbol: nlopt_set_munge

So, it seems, that the linking to the static library has to be extended/modified in some way. How should I change it? I looked at Subsection Compiling in subdirectories on http://cran.r-project.org/doc/manuals/R-exts.html but this shows an example, where there is code in subdirectories, that has to be archived into a static library. 

Is it even possible to put already a static library into the package and then compile? Or do I have to put in all source files of the NLopt library and create during compiling the package the static library of the NLopt library?

How is it intended to be done?



More information about the Rcpp-devel mailing list