<div dir="ltr">On Fri, 6 Nov 2020 at 02:11, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 4 November 2020 at 15:24, Jon Davidson wrote:<br>
| I have an existing Rcpp module that has already been compiled into a .so.<br>
| How can I integrate this into an R package?<br>
<br>
I am afraid you can't as an .so file can only be used on one architecture,<br>
and likely one subsets thereof (i.e. a Debian object file may not work on<br>
Fedora, or Ubuntu, or maybe even a different Debian version).<br>
<br>
That is why "the documentation" (ie WRE, CRAN Policy) say source only.<br></blockquote><div><br></div><div>If you *really* wanted to go down this path, you could write a shim and distribute that as source.  That shim could then somehow deduce the appropriate compiled version and load it; the shim could, if you wished, even download it.</div><div><br></div><div>This approach has the following notable points:</div><div><br></div><div>* If the Rcpp module depends on any part of Rcpp (it will!) and has been compiled, whether into a .so or something else, then *<b>it is already bound by the terms of GPLv2 or later*</b> (see the Rcpp FAQ 1.5).  If you distribute the compiled work, then the infectious nature of GPL means you must also make the source available.  Rcpp does not provide a way of distributing compiled modules as a way of protecting IP, which I suspect is what you're trying to do here.</div><div><br></div><div>* Your module would not be accepted by CRAN, so you would need your own distribution mechanism.</div><div><br></div><div>* As Dirk points out, compiled code is not portable between OSs and architectures, and often not between versions or distributions of one OS.  If you go down this route, expect to have to provide many different .so files, including for some very unusual systems - which in turn means you'll end up buying/renting tin for odd systems *or* not supplying your module for them.  Fancy compiling for the Raspberry Pi?  At least that's only $35.  How about IBM's Power9 architecture?</div><div><br></div><div>My suggestion, I'm afraid, would be "Yeah.  Don't do that."</div><div><br></div><div>Cheers,</div><div><br></div><div>- Peter<br></div></div></div>