[R-pkg-devel] Fwd: Passing CRAN checks for a package linking to a system library on CRAN machines

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu May 13 10:41:14 CEST 2021

On 5/13/21 7:29 AM, Sokol Serguei wrote:
> Le 13/05/2021 à 07:06, SN248 a écrit :
>> I am working on a package which provides an interface to the libsbml C++
>> library (http://sbml.org/Software/libSBML) in R. The source code of this
>> package (r2sbml) can be found at the following link
>> https://github.com/sn248/r2sbml
>> The package passes CRAN checks with `R CMD check` on my machine, but 
>> I do
>> have dependency (libsbml library) installed on my machine (OSX) with
>> headers and static libs at the usual locations, i.e., /usr/local/include
>> and /usr/local/lib. The package also passes CRAN check on a Windows 
>> machine
>> with libsbml installed using Rtools40 and msys2. The DESCRIPTION file 
>> lists
>> libsbml in SystemRequirements but `R CMD check` obviously fails on rhub
>> machines because there are no instructions to install libsbml first. 
>> As I
>> understand, I have the following options to pass checks on CRAN
>> 1. Bundle the source code of libsbml into the package and make the 
>> static
>> libs on the fly. I don't really want to try this approach even though I
>> have used this approach before in another package as I think creating 
>> the
>> static lib is not as straightforward for this library because of the 
>> large
>> number of files and complex dependency chart.
>> 2. Include header files in the `inst` folder and pull the static libs 
>> from
>> rwinlib github (assuming the libs can be posted there). I am not sure if
>> this approach will work on all platforms on which CRAN checks take 
>> place.
>> 3. Somehow include instructions to install libsbml on CRAN machines 
>> (I have
>> no idea how to do this), or request CRAN maintainers to install libsbml
>> with header files and libs at usual locations (i.e., 
>> /usr/local/include and
>> /usr/local/lib).
> I faced the same problem for my package r2sundials and in the end, I 
> have opted for including the third-party source code into the package. 
> However, a CRAN team member told me later that such kind of request 
> (i.e. install third-party software on CRAN machines) can be sent to 
> the CRAN team. Not sure that they accept but I think you can start by 
> asking it and if the request is rejected, you can try other options.

I think that sundials is a good example why trying the other options 
first is a good suggestion. It is now included in three CRAN packages 
(paropt, r2sundials, sundialr). Apart from the duplication (build time), 
it has a problem of multiply defined symbols (tentative definitions, 
issues with -fno-common, which is the default in GCC 10), which now has 
to be handled in the three packages separately.

> Best,
> Serguei.
>> I am sure some version of this question has been asked before as 
>> there are
>> many packages which interface with C/C++ libraries listed as
>> SystemRequirements, but I could not find a clear answer to this aspect,
>> i.e., passing checks on CRAN machines.
>> Any guidance here and pros/cons of the above mentioned approaches 
>> will be
>> very helpful.
>> Thanks
>> Satya
>> [[alternative HTML version deleted]]
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list