简体   繁体   English

R CMD SHLIB中标志的构造

[英]Construction of flags in R CMD SHLIB

I am having a lot of trouble understanding the steps that construct the compilation flags when using R CMD SHLIB . 使用R CMD SHLIB时,在理解构造编译标志的步骤时遇到很多麻烦。 I use the following: 我使用以下内容:

  • in ~/.R/Makevars define `CPPFLAGS=-O3' ~/.R/Makevars定义`CPPFLAGS = -O3'
  • in src/Makevars.win define PKG_CPPFLAGS = -O3 src/Makevars.win定义PKG_CPPFLAGS = -O3
  • include Rcpp and RcppGSL as dependencies in the DESCRIPTION file 在描述文件中包含Rcpp和RcppGSL作为依赖项

where the second step is clearly redundant, but I do it just in case PKG_CXXFLAGS was initialized to something different. 这里的第二步显然是多余的,但是我这样做是为了防止PKG_CXXFLAGS被初始化为不同的东西。

But when I run R CMD SHLIB I find my -O3 flags but also -UNDEBUG -Wall -pedantic -g -O0 . 但是,当我运行R CMD SHLIB我发现了-O3标志,而且还有-UNDEBUG -Wall -pedantic -g -O0 Where can those additional flags be coming from? 这些额外的标志从哪里来? Can Rcpp and RcppGSL affect these flags in a way I can't control through my Makevars.in? Rcpp和RcppGSL可以以我无法通过Makevars.in控制的方式影响这些标志吗?

For per-user, or personal settings, I just use ~/.R/Makevars which will affect all R CMD SHLIB or R CMD COMPILE calls, including those from Rcpp. 对于每个用户或个人设置,我只使用~/.R/Makevars ,这将影响所有R CMD SHLIBR CMD COMPILE调用,包括来自Rcpp的调用。

You can also define them in per-project Makefiles, or src/Makevars , and besides the per-user files, you can of course edit the system-wide variant (which is where the other values that confused you came from). 您还可以在每个项目的Makefiles或src/Makevars定义它们,并且除了每个用户文件之外,您当然可以编辑系统范围的变体(这是您混淆其他值的地方)。 See the file $R_HOME/etc/Makeconf for the latter. 请参阅文件$R_HOME/etc/Makeconf

Lastly, DESCRIPTION has nothing to do here. 最后, DESCRIPTION与此处无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM