[Rd] Re: Compiler-specific flags with PKG_CFLAGS
simon.urbanek at r-project.org
Wed Feb 9 19:56:30 CET 2005
On Feb 9, 2005, at 12:21 PM, Paul Roebuck wrote:
> On Wed, 9 Feb 2005, Kurt Hornik wrote:
>> I think the simplest way to achieve this is to configure R
>> locally (for yourself) with CFLAGS="-O2 -Wall -pedantic" but
>> leave the corresponding PKG_CFLAGS etc variables in package
>> src/Makevars alone.
> I can do that for workstations which I have admin priviledges
> and have a private version of R; how about the ones I don't?
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 ;).
More information about the R-devel