How can I improve the Makevars file for the Rcpp package (RcppEigen)?

I have an R package for which I moved the MCMC algorithm containing matrix algebra to C++ using the RcppEigen package, which greatly improved speed.

However, the R CMD check provides the following NOTE on Linux ( Thanks to R-Forge ):

 * checking installed package size ... NOTE installed size is 6.6Mb sub-directories of 1Mb or more: libs 6.1Mb 

This warning is probably not related to the incredible size of my C ++ code ( which is only about 150 lines ), since it only appears on Linux, but probably my inability to properly configure the Makevars file. (I have never used make or makefile before).
Also, when sending the package to CRAN Brian Ripley wrote something about this NOTE , which makes me expect this to be a Makevars problem: "This comes from debugging characters."

My Makevars are the standard Rcpp Makevars (listed below) created by Rcpp.package.skeleton .

My questions:

  • How to configure my Makevars in such a way as to reduce the size of the compiled library in Linux (i.e. get rid of NOTE )?
  • What are some good resources on how to get into the magic of Makevars for Rcpp ?
    (I didn’t find anything in Gallery , and the manual for extending R on this was also incomprehensible to me)

my Makevars :

 ## Use the R_HOME indirection to support installations of multiple R version PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` PKG_CPPFLAGS = -I. -I../inst/include 

my Makevars.win :

 ## This assume that we can call Rscript to ask Rcpp about its locations ## Use the R_HOME indirection to support installations of multiple R version PKG_LIBS = $(shell $(R_HOME)/bin/Rscript.exe -e "Rcpp:::LdFlags()") PKG_CPPFLAGS = -I. -I../inst/include 
+6
source share
1 answer

You quote what we wrote. There is nothing specific here: you just want to learn about the basic Makefile syntax and parameters.

Using src/Makevars , if you do not understand what you are doing, is not recommended. You are likely to break something, in particular, relying on a different architecture. Simon Urbanek is very categorical regarding this advice.

Brian Ripley, of course, is semi-correct: if debugging is enabled, there are more libraries. But CXXFLAGS never installed, especially the -g flag is set to enable debugging. So this is not us: if debugging is enabled by default, something else turned it on. By default, R can be R. See .R/Makevars .

Another driver for size is C ++ templates. Compare with other packages using (Rcpp) Eigen, they are also great. This is “just the cost of doing business”: templates give you the (coding) power that you enjoy.

Edited for typos

+7
source

Source: https://habr.com/ru/post/945568/


All Articles