Skip to content

[R-pkg-devel] Package with external non-Windows C library

2 messages · Simon David Jacobs, Dirk Eddelbuettel

#
Hi all,

I am trying to write an R package that relies on an external C library. My
understanding is that the prefered method is to include the C library in
the `src' folder of the package. I'm running into two problems that may
prevent this package from being distributed on CRAN:

1) The library is a standard configure; make; make install build. I don't
think it will be able to be installed on Windows without cygwin. Does this
automatically disqualify my package from being distributed on CRAN?

2) The library's makefiles have GNU extensions, leading to the following
WARNING with R CMD check:
* checking for GNU extensions in Makefiles ... WARNING
Found the following file(s) containing GNU extensions:
  src/snap-0.4/test/Makefile
  src/snap-0.4/test/Makefile.in
Portable Makefiles do not use GNU extensions such as +=, :=, $(shell),
$(wildcard), ifeq ... endif. See section ?Writing portable packages? in
the ?Writing R Extensions? manual.

Is there a possible workaround here without porting the library? FYI, the
library in question is the SNAP graph code:
http://snap-graph.sourceforge.net/

Thanks in advance.

Best,
Simon

--
Simon Jacobs
Research Programmer
Research Computing Center
University of Chicago
sdjacobs at uchicago.edu
#
Hi Simon,
On 19 August 2015 at 18:39, Simon David Jacobs wrote:
| I am trying to write an R package that relies on an external C library. My
| understanding is that the prefered method is to include the C library in
| the `src' folder of the package. I'm running into two problems that may

There are examples for both approaches on CRAN (even within my packages).  It
can get tricky with more obscure libraries; snap by be an example for that.

| prevent this package from being distributed on CRAN:
| 
| 1) The library is a standard configure; make; make install build. I don't
| think it will be able to be installed on Windows without cygwin. Does this
| automatically disqualify my package from being distributed on CRAN?

It's complicated.  You could try pre-creating Makefiles for windows.  You
could exclude Windows (at least at the beginning).
 
| 2) The library's makefiles have GNU extensions, leading to the following
| WARNING with R CMD check:
| * checking for GNU extensions in Makefiles ... WARNING
| Found the following file(s) containing GNU extensions:
|   src/snap-0.4/test/Makefile
|   src/snap-0.4/test/Makefile.in
| Portable Makefiles do not use GNU extensions such as +=, :=, $(shell),
| $(wildcard), ifeq ... endif. See section ?Writing portable packages? in
| the ?Writing R Extensions? manual.
| 
| Is there a possible workaround here without porting the library? FYI, the

Yes, either rename each Makefile to GNUmakefile, or add 'GNU make' to
SystemRequirements. 

Hth, Dirk

| library in question is the SNAP graph code:
| http://snap-graph.sourceforge.net/
| 
| Thanks in advance.
| 
| Best,
| Simon
| 
| --
| Simon Jacobs
| Research Programmer
| Research Computing Center
| University of Chicago
| sdjacobs at uchicago.edu
| 
| ______________________________________________
| R-package-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-package-devel