Apple 编译器的“bjam --toolset=”和标记值?
使用 bjam
构建 Boost 二进制库时,可以通过使用 --toolset= 的某些值来指定要使用的编译器,无需指定特定的编译器版本
选项。例如:
bjam --with-serialization --toolset=msvc
工具集值 msvc
告诉 bjam
进行搜索您的系统安装了某些版本的 Microsoft Visual C++,然后使用它构建 Boost.Serialization 库的多个变体。生成的库将包含一个标签,指示实际使用了哪个工具集。例如,上述命令创建如下文件:
libboost_serialization-vc100-mt-s-1_44.lib
libboost_serialization-vc100-mt-sgd-1_44.lib
...
其中文件名中的字符串 vc100
是一个 工具集标记,指示 Microsoft Visual C++ 2010找到编译器版本并用于构建库。 [有关 Boost 库文件命名约定的更多详细信息,请参见 此处。]
还可以使用 --toolset=
选项的某些其他值来指定编译器的特定版本。例如:
bjam --with-serialization --toolset=msvc-9.0
告诉 bjam,即使我的系统上可能有多个编译器,我也希望它专门使用 Microsoft Visual C++ 2008。生成的库包含标记字符串 vc90
,以指示使用 Microsoft Visual C++ 2008 来构建它们。
对于 Mac 上较新的编译器来说,Boost 文档似乎有点过时了(例如,如何区分 GCC、LLVM-GCC 和 LLVM?)
我的问题是,其他一些是什么 bjam --toolset=
值以及 Mac 上 Xcode 3 和 Xcode 4 中特定编译器版本的相应标签(不是 通用编译器名称值(例如 darwin
)?这些记录在任何地方吗?即使 Boost 尚不支持构建某些版本的 Boost 库,是否已指定工具集
和标签值?
请帮助替换此表中的 ???
:
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 生产自己的 GCC 和 LLVM 编译器版本,以添加 Apple 特定的扩展和行为。
(2) 仅适用于 Xcode 3。
(3) 仅适用于 Xcode 4。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有从指定的工具集到标签的基础部分的直接映射。因此,对于您指定的使用
darwin.jam
工具集的任何 Apple Xcode 编译器,标记的开头始终为xgcc
(对于 Xcode GCC)。第二部分,即编译器的版本号,通常是从编译器本身自动发现的。darwin.jam
工具集代码使用-dumnpversion
选项来发现该版本是什么(请参阅darwin.jam 第 123 行)。有几点:g++
始终是toolset=darwin
。site-config.jam
或user-config.jam
来告诉 Boost Build 您拥有的编译器在哪里(请参阅 BB 配置 文档) 。toolset=darwin-
与您在配置中指定的内容匹配。darwin.jam
工具集支持根据您要构建的内容智能选择编译器,使其变得更容易。例如,我使用类似以下内容进行 iOS 开发:
为此我可以:
bjam toolset=darwin-4.0
-- 对于使用 GCC 4.0 的常规 OSX 构建。这会产生标签xgcc-42
。bjam toolset=darwin-4.2
—— OSX 和 GCC 4.2 类似。为此,我将获得xgcc-42
标签。bjam toolset-darwin Architecture=arm target-os=iphone
-- 使用 GCC 4.2 构建 iPhone 设备。该标签最终也是 xgcc42,这是一个冲突。但我们在这些标签中的作用是有限的。这通常不是问题,因为无论如何都会跨平台隔离构建结果。您可以通过在配置中添加以下内容来设置使用其中一种 LLVM 编译器:
并使用
bjam toolset=darwin-4.2~llvm~gcc
进行调用。不幸的是,该标签也将是xgcc-4.2
(同样,它基于使用darwin.jam
)。因此,您需要将生成的库与其他 GCC 版本分开。同样不幸的是,除了代码中之外,没有记录用于将工具集映射到标记值的位置(请参阅 BB common.jam 行 #801 到 #841)。
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.jam
toolset 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.jam
toolset code uses the-dumnpversion
option to discover what that version is (see darwin.jam line #123). So a few things:toolset=darwin
for the defaultg++
.site-config.jam
oruser-config.jam
to 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.jam
toolset 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 beingxgcc42
which 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).