Subject: Re: [Boost-build] how to change release compiler flags options ?
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-06-18 14:08:11
Avi Bahra wrote:
>To build the release version I use:
> bjam -j2 variant=release
>On AIX this uses -03, unfortunately this causes some problems, so I want to replace
>-03 in release mode with -02.
>So in my site-config.jam file I tried:
> : requirements <variant>release:<cxxflags>-02 # serialization has problems with -03
>But when I ran this I got:
>xlC_r -c -02 -DNDEBUG -qcpluscmt -O3 -qstrict -qfuncsect -qeh -qrtti -I"/s1a/emos_esuite/emos_data/sms/boost_1_42_0" -I"ACore/src" -o "ANattr/bin/vacpp/release/link-static/threading-multi/src/TodayAttr.o" "ANattr/src/TodayAttr.cpp"
>/usr/local/lpp/vacpp11101/usr/vacpp/bin/.orig/xlC_r: 1501-216 (W) command option -02 is not recognized - passed to ld
That's because you have typed 02 (zero two) and not O2 (o two). But even if it were typed correctly, that approach may not work because the release variant already produces an optimization option (namely -O3) which would cause either a conflict or an option overriding where the last option would win (but it's not easy to guess which one that would be). I never used xIC myself to know for sure whether that would be a conflict or an override, though.
>It appears that <cxxflags> is only additive, is there any
>way to actually replace flags compiler flags for a given build variant ?
cxxflags is a free feature. You can remove an inherited free property, but the thing is <variant>release does not use <cxxflags> feature, nor <cflags> feature for that matter, to specify optimization flags. So there is no <cxxflags>-O3 property to remove. Instead, <variant>release is composed of <optimization>speed (along with values for some other relevant features). <optimization>speed gets later processed by the specific toolsets to produce appropriate options, but that is not done by utilizing <cflags> or <cxxflags> features per se, so again no apparent way to remove -O3 from <variant>release.
Anyway, there seems to be a way to accomplish that using this trick (or rather hack :) )
import feature ;
feature.extend optimization : unspecified ;
# then wherever appropriate:
requirements <variant>release:<optimization>unspecified <variant>release:<cflags>-O2
This does have some rough edges, but they could be cleaned up with some polishing of the idea, but it might already be good enough.
>Any help appreciated
You can also consider to define your own variant and use it instead of <variant>release
> Best regards,
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk