Skip to content
Prev 15105 / 63421 Next

Compiler-specific flags with PKG_CFLAGS

On Feb 9, 2005, at 12:21 PM, Paul Roebuck wrote:
I don't get your point - if you are not admin and don't use your own R 
version, how do you expect to change behavior of the R you don't have 
write access to? You can't, as admin doesn't want you to. This still 
doesn't prevent you from compiling the package for yourself in your 
home, including any flags you like. R allows you to change whatever you 
like for the package you compile.
Adding such flags as above in the package itself doesn't make any sense 
IMHO, as you should expect that whatever flags R was compiled with were 
specifically provided to steer optimizations etc. There are 
platform/compiler version combinations where -O2 breaks numerical 
computations, so overriding this for your package will override a 
choice which was done deliberately and you're not even aware of. In 
addition -Ox may have been specified already, so you may in fact 
downgrade the optimizations. At the time of compilation of the package 
the user is free to override any flags, so he can do so if he knows 
what he's doing. The current approach is good at preventing the user 
from doing bad things by default and producing consistent code.
What Kurt mentioned was just a way to reduce typing effort (and achieve 
more consistency) when specifying flags for packages you compile for 
yourself - you're still responsible for the content of the files you 
put there, so it's up to you to be aware of the issues you mentioned - 
R can't do that for you. You get what you tell R to do - there is no 
automatic protection against misuse ;).
Cheers,
Simon