构建静态链接的Boost (MinGW)
我正在使用 bjam 为 MinGW 构建 Boost(我正在使用系统和文件系统):
bjam --toolset=gcc stage
它构建得很好,但我希望能够静态链接到它(我必须为最终产品提供一个文件),所以我尝试过:
bjam --link=static --toolset=gcc stage
但我得到相同的输出。 有任何想法吗?
编辑连续第二个问题,我在发布后不久就回答了:p我想我会把这个问题留给其他人。
bjam --build-type=complete --toolset=gcc stage
肯定会构建动态和静态。
I'm building Boost (I'm using System and FileSystem) for MinGW using bjam:
bjam --toolset=gcc stage
And it builds fine, but I want to be able to statically link to it (I have to have a single file for the final product) so I tried:
bjam --link=static --toolset=gcc stage
But I get the same output. Any ideas?
edit second question in a row I've answered moments after posting :p guess I'll leave this up here for others though.
bjam --build-type=complete --toolset=gcc stage
Will build both dynamic and static for sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为 link 是一个属性,而不是 bjam 的一个选项。 这意味着在它之前不应该有 -- 。
这是我仅构建静态库的命令行(尽管是 Visual C++):
将其映射到原始构建命令我想说它应该看起来像这样:
或者也许:
尝试运行
有关 bjam 的属性和选项的更多信息。
I think link is a property as opposed to an option for bjam. That means that there should be no -- before it.
This is my command line for building only static libraries (visual c++ though):
Mapping that to your original build command I would say it should look something like this:
or perhaps:
Try running
for more info on properties and options for bjam.
只是想注意,使用较新的 boost(2011 年 2 月),您现在还需要构建 bjam.. 由于某种原因,当前可下载的 bjam 无法正常工作。
首先:
cd ...\boost_1_45_0\tools\build\v2\engine\src
build.bat mingw
您需要将 bjam 添加到 PATH(从控制面板,不仅仅是在 cmd 提示符下)。 然后
cd ...\boost_1_45_0\
bjam --build-type=complete --toolset=gcc stage
我的设置是 Vista、Boost 1.45、MinGW 4.5,并从cmd.exe 不是 msys。
http://code -slim-jim.blogspot.com/2011/02/boost-in-vista-using-mingw-and-cmdexe.html
Just want note that with the newer boost (Feb 2011) you need to build bjam as well now.. for some reason the current downloadable bjam doesn't work cleanly.
So first:
cd ...\boost_1_45_0\tools\build\v2\engine\src
build.bat mingw
Youll need to add bjam to the PATH (from control panel, not just on the cmd prompt). Then
cd ...\boost_1_45_0\
bjam --build-type=complete --toolset=gcc stage
My setup is Vista, Boost 1.45, MinGW 4.5, and building from cmd.exe not msys.
http://code-slim-jim.blogspot.com/2011/02/boost-in-vista-using-mingw-and-cmdexe.html
我自己没有在 MinGW 中构建这个,但我相信你的第一个构建将输出动态和静态库,第二个构建将仅输出静态库,因此如果你没有在构建之间清理构建目录,它可能看起来是一样的。
当您写“我必须有一个文件...”时,您的意思是您需要一个包含所有 boost 库的单个库吗? 如果是这样,我怀疑你可能必须自己将它们“组合”在一起。
I have not built this myself in MinGW but I believe your first build will output both dynamic and static libraries and the second only static ones, so if you did not clean the build directories in between builds it will probably look the same.
When you write "I have to have a single file..." do you mean you need a single library containing all boost libraries? If so, I suspect you may have to 'ar' them together yourself.
我使用以下命令行来构建 boost 的静态链接和动态链接版本:
这是在 Windows YMMV 上使用 Visual C++ 完成的。
I use the following command line to build both the statically linked as well as the dynamically linked versions of boost:
This is done with visual c++ on windows YMMV.