[Rd] suppressing "global" cppflags in an individual package

Hin-Tak Leung hin-tak.leung at cimr.cam.ac.uk
Tue May 9 18:49:29 CEST 2006


Kasper Daniel Hansen wrote:
> Hi
> 
> I can use PKG_CPPFLAGS in a Makevars file to add additional flags to  
> the c++ compiler for a given package. Is it possible to remove flags  
> passed to the packages from R. Eg: say R have been compiled with -O2  
> and I want the package to be compiled with another optimization level?

Do you mean the flags passed to the c++ compiler (CXXFLAGS) or
to the C proprocessor (CPPFLAGS)? Do not confuse the two.

I think the "proper" way would be to write a full makefile.
(there are plenty of examples on CRAN).

Now, out of curiosity - why would you want to do that? The actual 
difference in CPU time usage is often small (10%?), so unless the
package triggers a compiler bug at specific optimization level and
gets mis-compiled, it is probably not worth the trouble. And if
the package is that sensitive to optimization level and can get 
mis-compiled, one of them (the package or the compiler) needs fixing.

HTL



More information about the R-devel mailing list