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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Sep 26 11:30:39 CEST 2014


You have not given us the 'at a minimum' information required by the 
posting guide, and it is -O2 etc (not O2 and not -o2).

Also, cpp is the C pre-processor: if you mean C++, say so.

The default compiler flags are set by whoever compiled R: it is entirely 
possibly they were set differently for C++98 and C++11 (which looks 
relevant).

It seems you need to read 'R Installation and Admnistration' which has a 
comprehensive description of these flags.


On 26/09/2014 10:00, kaveh wrote:
> 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)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK



More information about the R-devel mailing list