Boost logo

Boost-Build :

Subject: Re: [Boost-build] Cannot get feature/subfeature not working with Oracle Solaris Studio C++ compiler
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2015-03-26 12:21:18


AMDG

On 03/26/2015 06:15 AM, Edward Diener wrote:
> I am trying to use the feature/subfeature part boost build in order to
> run different setups of the Oracle Solaris Studio C++ compiler on Linux.
> This is still called the 'sun' compiler in the Boost Build
> doocumentation. Under linux I have versions 12.2, 12.3, and 12.4 on the
> compiler installed. I have a bash file for switching between the
> versions before using build to invoke the sun compiler.
>

What does this bash script need to do? Ideally you
should be able to handle this in user-config.jam.

> My lines in user_config.jam for sun are:
>
> import feature ;
> import toolset ;
>
> using sun : 12.2 : : <cxxflags>-features=tmplife
> <cxxflags>-features=tmplrefstatic ;
> using sun : 12.3 : : <cxxflags>-features=tmplife
> <cxxflags>-features=tmplrefstatic ;
> using sun : 12.4 : : <cxxflags>-features=tmplife
> <cxxflags>-features=tmplrefstatic ;
>
> feature.subfeature toolset sun-12.4 : library : stlport apache cxx03
> cxx11 : optional composite propagated ;
>

Don't specify the version when defining the
subfeature. <toolset-sun:version> is also
a subfeature. I don't think that subfeatures
can be nested like this.

> feature.compose <toolset-sun-12.4:library>stlport :
> <cxxflags>-library=stlport4 ;
> feature.compose <toolset-sun-12.4:library>apache :
> <cxxflags>-library=stdcxx4 ;
> feature.compose <toolset-sun-12.4:library>cxx03 : <cxxflags>-std=c++03 ;
> feature.compose <toolset-sun-12.4:library>cxx11 : <cxxflags>-std=c++11 ;
>
> If I then invoke b2 with
>
> b2 toolset=sun-cxx11
>

toolset=sun will always select toolset=sun-12.2,
since that's the first one that you declared.
This doesn't match up with the fact that you
declared the library subfeature for 12.4.

To be honest, I have no idea how this works
at all. I would have expected it to fail
when trying to parse the subfeature. I'm sure
that Boost.Build is getting very confused. I'll
see if I can improve the error checking.

> I would then assume that -std=c++11 is part of the compiler command
> line. But it is not. Instead -library=stlport is part of the compiler
> command line no matter how I invoke the compiler.
>

What version of Boost are you using? Until recently
Jamroot set <toolset>sun:<stdlib>sun-stlport, which
forces -library=stlport4. I would guess that Boost.Build
is picking up this and ignoring your subfeature.

> How do I correct this so that I can pass -std=c++11 and not pass
> -library=stlport to the command line of the compiler ?
>

See also https://github.com/boostorg/build/pull/60

In Christ,
Steven Watanabe


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