Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distributing a compiled executable with an R package

Tags:

package

r

I am preparing an R package that will include a third party compiled executable. The plan is to interface it to R using system() calls. I have permission to distribute this executable, but not its source code. Unfortunately it is only compiled under Windows 32 bit, and it is not possible to easily recompile it under different architectures.

Understanding that this package will have a somewhat limited audience, how should the executable be distributed? I also recognize that it will not be allowed on CRAN for this reason.

For example, should the executable be included in the /bin/ subfolder of the package installation, or alternately should the package somehow download the executable when it is itself installed.

In addition, what licensing issues, if any do I face under this scenario?

like image 748
digitalmaps Avatar asked Jan 23 '12 19:01

digitalmaps


1 Answers

I have worked on two packages that do something like this, both hosted on R-forge because of the CRAN binary restriction (which, by the way, seems perfectly sensible to me). (I don't think you're missing anything obvious in your question -- just saying here what I chose to do.)

  • the cpcbp package (common principal components/back-projection) uses a binary compiled from code written by Patrick Phillips; the source code is unredistributable because it uses some Numerical Recipes routines. I've been meaning to re-write this core in R (it's just straightforward numerical linear algebra, it wouldn't be that hard). It occurs to me that I probably have to go modify the license on this one -- I probably said "GPL" but I don't think I can actually do that given the unredistributable component ...
  • the glmmADMB package uses freely redistributable source code (BSD license), but the toolchain is sufficiently complicated that I don't want users to have to download the entire supporting package

In both cases I put the binaries in inst/bin and possibly under architecture-specific subdirectories (which get installed in /bin) and use the appropriate logic to detect the architecture and run the correct binary.

I guess in principle you could get around the inability to license via GPL by making the non-redistributable part into a download (as you suggest), but that would seem to violate the spirit ...

like image 198
Ben Bolker Avatar answered Oct 06 '22 18:10

Ben Bolker