如何改进Rcpp(RcppEigen)包的Makevars文件?

Hen*_*rik 6 makefile r rcpp

我有一个R包,我将包含矩阵代数的MCMC算法移动到C++使用RcppEigen包,这大大提高了速度.

但是,在Linux上R CMD check给出以下NOTE内容(感谢R-Forge):

* checking installed package size ... NOTE
  installed size is  6.6Mb
  sub-directories of 1Mb or more:
    libs   6.1Mb
Run Code Online (Sandbox Code Playgroud)

这个警告可能不是由我不可思议的C++代码大小(只有大约150行)驱动的,因为它只出现在Linux上,但可能是由于我无法正确配置Makevars文件.(我从未使用过make或makefile以前用过).
同样在提交包时CRAN,Brian Ripley写了一些关于这个问题NOTE,这让我觉得这是一个Makevars问题:"它来自调试符号."

我Makevars的标准Rcpp Makevars(如下所示)由我制作Rcpp.package.skeleton.

我的问题:

  • 如何配置我Makevars的方式减少Linux上编译库的大小(即摆脱NOTE)?
  • 什么是关于如何进入神奇的好资源Makevars为Rcpp?
    (我没有找到在任何画廊和在该R扩展手册也无法理解我)

我的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 
Run Code Online (Sandbox Code Playgroud)

我的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 
Run Code Online (Sandbox Code Playgroud)

Dir*_*tel 7

你引用我们写的东西.这里没有具体的内容:您只想了解基本的Makefile语法和选项.

乱搞src/Makevars,除非你知道你在做什么,不推荐.您可能会破坏某些东西,特别是在另一个架构上构建.Simon Urbanek对这个建议非常坚定.

Brian Ripley当然是半正确的:如果你启用了调试,那么库就更大了.但是CXXFLAGS从未设置过,特别是没有设置-g标志来打开调试.所以不是我们:如果默认情况下启用调试,则会启用其他内容.默认情况下可以是R. 看你的.R/Makevars.

另一个大小的驱动程序是C++模板.与使用(Rcpp)Eigen的其他软件包相比,它们也可能很大.这只是"开展业务的成本":模板为您提供了您所享有的(编码)功能.

编辑错别字