[Rcpp-devel] Packaging - and even more packaging

Douglas Bates bates at stat.wisc.edu
Sun Feb 3 21:51:37 CET 2013

On Sun, Feb 3, 2013 at 2:41 PM, Simon Zehnder <szehnder at uni-bonn.de> wrote:

> 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?

It is possible and we do so in the Matrix package where we have the .a
files from the various SuiteSparse C libraries but we modify the makefiles
in those libraries so that the .a file ends up in the src directory, not a
subdirectory of src.

It seems to work.

> How is it intended to be done?
> Best
> Simon
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130203/e49db9f1/attachment.html>

More information about the Rcpp-devel mailing list