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

Hin-Tak Leung hin-tak.leung at cimr.cam.ac.uk
Wed May 10 12:56:11 CEST 2006


Kasper Daniel Hansen wrote:
<snipped>
> It is indeed the case that after updating to GCC 4 the package gets 
> broken using -O2. I agree this needs to be fixed, but the error (which I 
> believe I have kind of localized, but not really understood) stems from 
> a C++ library we have little control over, so it would be nice to have a 
> fix for the time being that does not require a reinstallation of R - 
> especially since we actually have users who currently (or soon will be) 
> testing it. I was thus looking for a temporary quick fix allowing me to 
> disable the optimization level, while I take the time to fix it properly.
> 
> Kurt Hornik have replied of-list that it is possible to do so using a 
> ~/.R/Makevars file (which I have not had the time to test 
> unfortunately), but reading your comment about CPPFLAGS and CXXFLAGS 
> makes me think I can indeed override it using the package Makevars file. 
> The flags I was passing to the compiler were library locations anyway 
> which was for the preprocessor.

Can't do that with Makevars, because its defines are included first (and 
get overriden by R's built-time flags later in the command line), as 
Simon on the list has pointed out.

If it is a one-off operation, you can be slightly barbaric and just
record all the operations done by R CMD SHLIB/INSTALL
e.g. piping them to a file with >& , edit the file manually and exec
the operations by "sh file", then copy the differently-built shared
library over by hand, over-writing the broken one. Not very elegant,
but it will buy you some time until either the compiler or the package 
get fixed.

Hin-Tak Leung



More information about the R-devel mailing list