如何构建 boost 1.45 通用二进制文件?
如何构建 boost 1.45 通用二进制文件?豹子/雪豹?
How to build boost 1.45 universal binaries? on leopard/ snow leopard ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何构建 boost 1.45 通用二进制文件?豹子/雪豹?
How to build boost 1.45 universal binaries? on leopard/ snow leopard ?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
要在 OSX 10.6 上构建 4 路通用 boost 静态二进制文件,我执行以下操作:
从 boost 网站下载 boost。
将存档解压并
cd
到boost_x_xx_x
文件夹(其中x_xx_x
是您正在使用的 boost 版本)。运行:
./bootstrap.sh
然后# Boost.Jam 程序的名称在 Boost 1.47.0 中从“bjam”更改为“b2”
# 如果您正在编译 <= 1.46.1 版本,请将“b2”替换为“bjam”
./b2 macosx-version=10.6 macosx-version-min=10.4 Architecture=combined threading=multi link=static address-model=32_64
这将编译除 Boost.MPI(需要
--with-mpi
选项)之外的所有内容。构建产品放入./stage
更新: 如果您已经安装了 XCode 4,那么您必须执行一个额外的步骤。 XCode 4 不附带能够针对 PowerPC 的编译器或库。不幸的是,XCode 4 附带的编译器成为 Boost 使用的默认编译器。要强制使用 XCode 3 附带的编译器,您必须执行额外的步骤。请注意,如果您的系统上没有 XCode 3,则必须安装它。
运行
./bootstrap.sh
后,运行b2
之前,打开:将以下行添加到该文件。这指示 boost 使用 XCode 3 中的 g++-4.2:
To build 4-way universal boost static binaries on OSX 10.6 I do the following:
Download boost from the boost website.
Extract the archive and
cd
into theboost_x_xx_x
folder (wherex_xx_x
is the version of boost you are using).Run:
./bootstrap.sh
and then# The name of the Boost.Jam program changed from "bjam" to "b2" in Boost 1.47.0
# Replace "b2" with "bjam" if you are compiling a version <= 1.46.1
./b2 macosx-version=10.6 macosx-version-min=10.4 architecture=combined threading=multi link=static address-model=32_64
This will compile everything except for Boost.MPI (which requires the
--with-mpi
option). The build products get put in./stage
UPDATE: If you have installed XCode 4, then there is an extra step that you must perform. XCode 4 does not come with compilers or libraries capable of targeting PowerPC. Unfortunately, the compilers that come with XCode 4 become the default compilers used by Boost. To force the use of the compilers that come with XCode 3, you must perform an extra step. Note that you must install XCode 3 if it is not on your system.
After running
./bootstrap.sh
, and before runningb2
, open:Add following line to that file. This instructs boost to use the g++-4.2 from XCode 3:
您想要构建哪些库?它在这里说(http://www.boost.org/doc/libs/1_45_0/more/getting_started/unix-variants.html):
您确实需要构建的是:
那么您要构建哪一个?
Which libraries are you trying to build? It says here (http://www.boost.org/doc/libs/1_45_0/more/getting_started/unix-variants.html) that:
The one that you do need to build are:
So which one are you trying to build?
为了在 Tiger 下构建通用二进制文件,我创建了
我的主目录 (
文件:$HOME
) 中的 user-config.jam然后我像往常一样使用 Jam 构建 Boost。也许这应该仍然适用于较旧的 Mac OS X 版本。
另一种方法是使用 MacPorts,但在这种情况下,所有 Boost 依赖项都必须重新构建为通用二进制文件,这并不总是可行(我在 Tiger 上使用过两次,但失败了)。
对于这两种情况,您都需要随 XCode 安装 MacOSX10.4u.sdk。
[编辑]
要构建三种架构,您最好阅读回答类似的问题。简而言之,
user-config.jam
中的构建选项取决于您和目标 Mac OS X 版本。所以你最好根据上述答案尝试各种变体。To build universal binaries under Tiger I was creating
user-config.jam
file in my home directory ($HOME
):And then I was building Boost as usual with Jam. Probably this should still work with older Mac OS X versions.
Another way is to use MacPorts but in this case all Boost dependencies have to be rebuilt as universal binaries which is not always possible (I've this on Tiger for two times but failed).
For both cases you need to have MacOSX10.4u.sdk installed with XCode.
[edit]
To build for three architectures you'd better read an answer to a similar question. Briefly, build options in
user-config.jam
depend on your and target Mac OS X versions. So you'd better try various variants based on the aforementioned answer.