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

SN248 @n248 @end|ng |rom corne||@edu
Thu May 13 07:06:32 CEST 2021

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


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

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.


	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list