[Bioc-devel] package c++ optimization flag

Kasper Daniel Hansen k@@perd@nielh@n@en @ending from gm@il@com
Wed Sep 19 14:58:07 CEST 2018

This should be done extremely sparingly, but it is sometimes necessary if
you know that higher optimization breaks the code. But that is the only use
case. Otherwise you should trust the setting of the user who compiles R,
ie. you should for example never force a higher optimization level IMO.

We do this override in affxparser.  The issue with the approach in
affxparser is that it is non-portable, since we just overwrite the users
-O* setting. However, a flag like -O* is complier dependent, so this is
actually not a great solution (although it has worked for 10 years).  The
"right" way to do this - which I think we should have example code for - is
to use autoconfigure to detect that the compiler is GCC or clang and _then_


the relevant part is essentially

MYCXXFLAGS = -Wno-sign-compare -O0

%.o: %.cpp

(remember you need TABS in Makefiles)

On Wed, Sep 19, 2018 at 5:12 AM Håkon Tjeldnes <hauken_heyken using hotmail.com>

> When I put this line in makevars:
> This is the output of the cpp precompiler:
>  -O3 -fpic  -g -O2
> I read the cpp doc, and it states:
> "If you use multiple -O options, with or without level numbers, the last
> such option is the one that is effective."
> Since, system wide R optimization -O2 always comes last, how can I make my
> package overwrite the system wide optimization ?
> And should I do this at all, since debugging could get more difficult ?
>         [[alternative HTML version deleted]]
> _______________________________________________
> Bioc-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

	[[alternative HTML version deleted]]

More information about the Bioc-devel mailing list