[Rd] Why is my R package still compiling with the O2 flag?

kaveh kaveh.vakili at wis.kuleuven.be
Fri Sep 26 11:00:30 CEST 2014


When I install an R package with cpp codes such as rrcov via CRAN (under 
R 3.1.1, using no Makevars file and under Ubuntu 14.04 using GCC 4.8), 
the cpp code is compiled with the -o3 flag (in fact, looking at the 
Makeconf file this seem to again be the default since R 3.1.1) But when 
I install my own package via CRAN it is compiled with the -o2 flag.

My questions are what is causing my package's cpp code to be compiled in 
-o2 and how to fix this?

Here is the content of the src/Makeconf file of my package (it is fairly 
standard I believe for a package using RcppEigen):

     PKG_CXXFLAGS =  -I../inst/include -DEIGEN_DONT_PARALLELIZE 
$(SHLIB_OPENMP_CXXFLAGS)
     PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` 
$(SHLIB_OPENMP_CXXFLAGS)
     CXX_STD = CXX11

and that of rrcov (which I m using for illustration's sake):

     PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)



More information about the R-devel mailing list