[Rcpp-devel] Specify include path with Rcpp.plugin.maker

Dirk Eddelbuettel edd at debian.org
Wed Jul 18 17:56:20 CEST 2012

On 18 July 2012 at 17:13, Vaclav Petras wrote:
| Hello,
| how should be an include path for a plugin created by
| Rcpp:::Rcpp.plugin.maker specified?
| I'm using a library which is not in the standard path. I'm able to
| specify -Wl,-rpath and -L options but I don't know where -I should be
| specified.
| As an example I used the GSL example from Rcpp-FAQ. GSL headers are in
| standard path so everything works. But if I modify this example to use
| gsl_rng.h instead of gsl/gsl_rng.h it is necessary to set

Why?  Every GSL example uses

   #include <gsl/somefile.h>

and it is standard to specify it with directory/filename. Many libraries (eg
Boost) do the same.

| -I/usr/include/gsl somewhere. Only thing which worked for me is:
|  Sys.setenv(PKG_CXXFLAGS="-I/usr/include/gsl/")
| export CXXFLAGS or PKG_CXXFLAGS in command line (and than running
| Rscript) or using Makefile="-I/usr/include/gsl/" (plugin.maker param)
| didn't helped. I also tried
|  myplugin$env$PKG_CXXFLAGS <- "-I/usr/include/gsl/"
| but I got some R errors.
| My platform is GNU/Linux, dist. Ubuntu 10.04.

Many of us develop on that platform. "It just works."

| Now I'm trying compile simple function only but in the future I want
| to build some R package too, so I'm asking if there can be problem
| with this also in this case (I didn't studied documentation for
| building packages yet).
| I think that some parameter is missing in the interface
| (Rcpp.plugin.maker) or that the documentation is not complete (or I'm
| just missing something of course).

Yes, I think you just confused yourself.

For _truly new libraries_ and non-standard locations, you may have to use a
combination of autoconf / configure to specify what goes into the plugin
maker. But for something as common as the GSL, this not an issue.

If I misunderstood your question and you are wondering how to generally
modify the plugin components: you probably want to look at the code in the
inline package, as well as for the R commands. As I recall, every variable
set in the plugin environment gets passed on before system() is called.  So
you could try PKG_CFLAGS etc as documented for R CMD INSTALL et al.


| Thanks for help,
| Vaclav
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  

More information about the Rcpp-devel mailing list