[Rd] Rcpp, best method for linking to

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Feb 25 11:07:12 CET 2006


On Fri, 24 Feb 2006, Dirk Eddelbuettel wrote:

> On 24 February 2006 at 15:00, Andrew Garbutt wrote:
> | Sorry, that's not quite what I was asking.  I was asking more of a "best
> | practice" kind of question. My own C++ codes compile fine and are
> | accessible to R with some great #define magic.  I was noting that the
> | Rcpp package has some generic classes to handle conversion of SEXP
> | structures to STL and back again. As I far as I can see, using them
> | would require that I compile the C++ code into a library and link to
> | that library. Or copy the code into my own code base, but doing would
> | restrict myself to the GPL, as it would be a derivative work?? (IANAL)
> | At this point I do not want to commit to any particular licensure for my
> | package.
>
> I may be misunderstanding you but here it goes: if you are using Rcpp as a
> means to get to R, you still end up linking with R itself.  It is my
> understanding that this implies the GPL -- or a suitable GPL-compatible
> license -- for your code.

As you know, what constitutes 'linking' and 'using' is controversial (and 
legal experts do not agree except perhaps that it would need to be tested 
in court and the interpretation may differ by country).  See e.g.

http://www.gnu.org/licenses/gpl-faq.html#MereAggregation

for one (extremal) viewpoint which might appear to disqualify the 
distribution of any non-GPL R package.

But there are statements in the R codebase which could be taken to be more 
liberal (and in the UK would be considered to have a legal bearing).

R's COPYRIGHTS file says (in connection of declaring certain header files 
to be under LGPL).

     It came to our attention that some projects are interpreting GPL to
     mean that compiling against the header files or linking against a
     Windows import library brings the compiled code under the scope of
     GPL.  This would mean it would be impossible to distribute binary
     versions of non-GPL packages with compiled code which called entry
     points in the R executable or DLL, of which there are many on CRAN.

     We encourage packages to be distributed under Open Source conditions,
     but accept that this is not possible for some contributions.  Our
     intention is that export files and import libraries be `accessors'
     under clause 5 of the LGPL, so that in most cases no (additional)
     restrictions are imposed by compiling a package using the LGPL-ed
     components of R.

> I do not see any _additional restriction_ coming in via the addition of
> Rcpp. You already use GPL'ed object files / libraries via R itself. Plus
> you're presumably building with R toolchain via 'R CMD INSTALL ....'

Building with a GPLed compiler does not impose license conditions on the 
executable, and similarly with the R toolchain on built packages, as far 
as I am aware.

We do not currently have a mechanism for one R package to make use of the 
compiled code of another.  When we do, the licence condition on the 
exporting package becomes relevant.  That is already relevant for 
rproxy.dll, where the author chose to use LGPL.  So I think there are 
grounds for suggesting the Rcpp might be more usable under LGPL in some 
circumstances.

[All I am trying to do here is to point out that there are multiple 
viewpoints.]

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list