On 3 December 2014 at 07:40, Prof Brian Ripley wrote: > On 02/12/2014 18:34, Louis Aslett wrote: >> I've been hunting round for the accepted method of bundling system >> dependencies into binary packages. >> >> For example, there are some CRAN packages (e.g. gmp, RcppArmadillo, >> ...) which don't require the system dependencies be installed for the >> Windows and Mac binary builds. I understand that there are a very >> limited number of packages for which CRAN would do this, so as a first >> step I'm *not* asking how to get this on CRAN, but rather this >> highlights there must be a (fairly automated/easy) mechanism to >> achieve this. Is it as simple as statically linking? If so there's > > Well, packages using just C++ headers (RcppArmadillo is one) do not have > libraries to link to.
Sorry, yes I discovered when I went to do a concrete example that I was mistaken in thinking RcppArmadillo fell under the category of packages I was thinking about. gmp is the exemplar for bundling dependencies that my query was driving at. > > But as far as possible the Windows and OS X binary packages are > statically linked. What is available to CRAN package builds is at > http://www.stats.ox.ac.uk/pub/Rtools/libs.html > http://r.research.att.com/libs/ (and includes gmp). > >> surely an automated way to trigger this without having to modify >> Makevars to produce the static linked packages? >> >> The Writing R Extensions manual section on binary packages doesn't >> mention this and I've tried extensive Googling without joy. > > Nothing special is needed: the linkers use static linking if there is no > dynamic library available. So the external software is built with > configure options --enable-static --disable-shared . On OS X it also > has to be built with PIC flags (not the default for static libraries). > Ok, this was exactly the issue ... my GMP didn't have PIC for the static library. As soon as I recompiled GMP using --with-pic for the configure script I was able to temporarily rename my dynamic library versions of GMP and FLINT and it picked up the static libraries without throwing any errors. Thank you very much -- I wasn't at all aware PIC was needed for static code on OS X! I'd assumed I was missing something much more elaborate. >> So in a nut shell, I'm looking to bundle a binary version of GMP >> (https://gmplib.org) and FLINT (http://flintlib.org) into my package >> for Windows/Mac users who can't/won't compile the libraries and which >> I can distribute independently of CRAN, but without having to do so in >> a manual/hacky way by tweaking Makevars each time, or modifying the >> tgz/zip produced by R. > > There are a few exceptions where dynamic linking is used on Windows, and > the configure scripts are used to install DLLs into the libs directory. > (RCurl is one, currently.) The main reason for not doing so is naming > conflicts for DLLs on Windows. For example, if you were to have a > gmp.dll and so did package gmp, the first loaded would win, even though > they might be different versions (and this was common for zlib1.dll). > Many thanks again, Louis ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel