When building Boost binary libraries with bjam, one may specify which compiler to use, without specifying a particular compiler version, by using certain values for the --toolset= option. For example:
bjam --with-serialization --toolset=msvc
the toolset value msvc tells bjam to search your system for some version of Microsoft Visual C++ and then use it to build a number of variants of the Boost.Serialization library. The resulting libraries will contain a tag indicating which toolset was actually used. For example, the above command creates files such as:
libboost_serialization-vc100-mt-s-1_44.lib
libboost_serialization-vc100-mt-sgd-1_44.lib
...
where the string vc100 in the filename is a toolset tag indicating that the Microsoft Visual C++ 2010 compiler version was found and used to build the libraries. [More details about Boost library file naming conventions can be found here.]
One may specify also a specific version of a compiler using certain other values for the --toolset= option. For example:
bjam --with-serialization --toolset=msvc-9.0
tells bjam that, even though I may have several compilers on my system, I want it to specifically use Microsoft Visual C++ 2008. The resulting libraries contain the tag string vc90 to indicate that Microsoft Visual C++ 2008 was used to build them.
The Boost documentation seems to be a bit out-of-date with respect to newer compilers on the Mac (e.g., how does one distinguish between GCC, LLVM-GCC and LLVM?)
My question is, what are some of the other bjam --toolset= values and their corresponding tags for specific compiler versions in Xcode 3 and Xcode 4 on the Mac (not the general compiler name values like darwin)? Are these documented anywhere? Even if building Boost libraries with some versions is not yet supported by Boost, have the toolset and tag values been specified yet?
Please help replace the ???s in this table:
TOOL AND VERSION --toolset= TAG
======================================================
Microsoft Visual C++ 2008 msvc-9.0 vc90
Microsoft Visual C++ 2010 msvc-10.0 vc100
Apple (1) GCC 4.0 (2) ??? xgcc40
Apple GCC 4.2 ??? xgcc42
Apple LLVM GCC 4.2 ??? ???
Apple LLVM compiler 1.5 (2) ??? ???
Apple LLVM compiler 2.0 (3) ??? ???
(1) Apple produces their own versions of the GCC and LLVM compilers to add Apple-specific extensions and behavior.
(2) Available in Xcode 3 only.
(3) Available in Xcode 4 only.
There is a direct mapping from the toolset specified to the base part of the tag. Hence for any Apple Xcode compiler that you specify that uses the
darwin.jamtoolset the start of the tag will always bexgcc(for Xcode GCC). The second part, i.e the version number of the compiler, is usually automatically discovered from the compiler itself. Thedarwin.jamtoolset code uses the-dumnpversionoption to discover what that version is (see darwin.jam line #123). So a few things:toolset=darwinfor the defaultg++.site-config.jamoruser-config.jamto tell Boost Build where and which are the compilers you have (see the BB Configuration docs).toolset=darwin-<some_version>matches what you specify in your configuration.darwin.jamtoolset supports smart selection of the compiler based on what you are trying to build to make it a bit easier.For example I use something like the following for iOS development:
For which I can:
bjam toolset=darwin-4.0— For a regular OSX build with GCC 4.0. Which results in the tagxgcc-42.bjam toolset=darwin-4.2— Similarly for OSX and GCC 4.2. For which I would get a tag ofxgcc-42.bjam toolset-darwin architecture=arm target-os=iphone— To do an iPhone device build with GCC 4.2. The tag ends up also beingxgcc42which is a collision. But there’s a limit to how much we can account for in those tags. And it’s usually not a problem because one segregates built results across platforms anyway.You might set up using one of the LLVM compilers by adding to your configuration:
And invoke with
bjam toolset=darwin-4.2~llvm~gcc. Unfortunately the tag would also bexgcc-4.2(as again, it’s based on usingdarwin.jam). So you would need to segregate the resulting libs from the other GCC builds.Also unfortunate is that there isn’t a documented location of mapping the toolset used to the tag value other than in code (see the BB common.jam lines #801 to #841).