[R-pkg-devel] Validate CRAN package using a linked library

Martyn Plummer plummerm at iarc.fr
Wed Sep 14 22:38:22 CEST 2016


Most people who want to interface to an external library embed the source code of the library in their R package. I see that ginac is a C++ library which creates additional problems. Only a few R packages  interface to an external C++ library (e.g. the interfaces to SYMPHONY, gdal,  QuantLib, and JAGS).

Windows is a problem because the toolchain used by R uses static linking to the C++ runtime. This has two  side effects:

1)  Both the R package and the external DLL must be built with the same toolchain. So you can't just ask CRAN to install the Windows binary from the ginac web site.

2) You can't throw an exception across DLL boundaries.

As Dirk says, this is hard.

Martyn
________________________________________
From: R-package-devel <r-package-devel-bounces at r-project.org> on behalf of Dirk Eddelbuettel <edd at debian.org>
Sent: 14 September 2016 22:02
To: Dorel, Mathurin
Cc: r-package-devel at r-project.org
Subject: Re: [R-pkg-devel] Validate CRAN package using a linked library

On 14 September 2016 at 12:52, Dorel, Mathurin wrote:
| I developed a package using the symbolic calculus C library ginac (http://www.ginac.de/<https://email.charite.de/owa/redir.aspx?REF=fSvQ3yE_XkDlPenE4F0MzYwBnO23griAuHvI5OZfSugms-XfndzTCAFodHRwOi8vd3d3LmdpbmFjLmRlLw..>).
| I want to submit my package to CRAN, but the library is not installed on CRAN computers
| so the C/C++ code does not compile on CRAN winbuilder (http://win-builder.r-project.org/upload.aspx<https://email.charite.de/owa/redir.aspx?REF=KMGXFEO-FDxPH92uJokI4LhZLoWd8IY1gdu9k7Wswrcms-XfndzTCAFodHRwOi8vd2luLWJ1aWxkZXIuci1wcm9qZWN0Lm9yZy91cGxvYWQuYXNweA..>).
|
| What would be an appropriate solution? Should I ask the CRAN administrators to install ginac on
| their test machines, or should I submit a source package in the style of BH which would provided
| a compiled version of the ginac library that I could link to?

Note that BH is _headers-only_ and hence works by LinkingTo: (which despite
its name is NOT used for linking)  which covers "most" of the Boost
functionality (but eg not Boost graph used in RBGL on BioC).

In general the problem you describe is "hard". See Writing R Extensions, and
use of SystemRequirements, plus possibly use of configure to detect library
presence at the compile-time of you package.

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

______________________________________________
R-package-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}



More information about the R-package-devel mailing list