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

Dirk Eddelbuettel edd at debian.org
Fri Jul 20 15:22:51 CEST 2012


Vaclav,

1)  I already told you not to use "include" without the gsl/ layer. Don't do
    that. It will bite you eventually when other GSL headers (with a
    hardcoded gsl/) try to call each other.

    This is a convention the upstream developers chose. Stick with it, or
    risk obscure bugs.

2)  I already told you about the existing plugin and its use of -I flags. Run
    the following:

    library(inline)

    fun <- cxxfunction(signature(), plugin="RcppGSL", verbose=TRUE, body='
        int answer = 42;
        return Rcpp::wrap(answer);
    ')

    and you should see


     >> setting environment variables: 
    PKG_LIBS = -L/usr/lib -lgsl -lgslcblas -lm $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib
    PKG_CPPFLAGS = -I/usr/include
    
     >> LinkingTo : RcppGSL, Rcpp
    CLINK_CPPFLAGS =  -I"/usr/local/lib/R/site-library/RcppGSL/include" -I"/usr/local/lib/R/site-library/Rcpp/include" 


    [...]
    
    Compilation argument:
     /usr/lib/R/bin/R CMD SHLIB file6de9438a5047.cpp 2> file6de9438a5047.cpp.err.txt 
    g++-4.6 -I/usr/share/R/include -DNDEBUG -I/usr/include
     -I"/usr/local/lib/R/site-library/RcppGSL/include"
     -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O0 -Wall -c
     file6de9    438a5047.cpp -o file6de9438a5047.o
    g++-4.6 -shared -o file6de9438a5047.so file6de9438a5047.o -L/usr/lib
     -lgsl -lgslcblas -lm -llapack -lblas -lgfortran -lm -lquadmath
     -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/lib/R/lib -lR

Dirk

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


More information about the Rcpp-devel mailing list