简体   繁体   English

在Windows 7上使用MinGW编译boost之前,如何构建Boost.Build?

[英]How do I build Boost.Build before compiling boost using MinGW on Windows 7?

I'm running Windows 7 Enterprise SP1 and trying to set up a C++ dev environment. 我正在运行Windows 7 Enterprise SP1,并尝试设置C ++开发环境。 I installed MinGW, and that seems to be working properly on its own. 我安装了MinGW,它似乎可以正常运行。 Next, I need to install boost... it seems the only good option is to compile from source. 接下来,我需要安装boost ...似乎唯一的好选择是从源代码进行编译。 (I don't see any official Windows binaries. I found several unofficial ones, but they tend to be several version behind current and it isn't clear that they're being maintained.) (我没有看到任何官方的Windows二进制文件。我发现了几个非官方的二进制文件,但是它们往往比当前版本落后几个版本,并且尚不清楚它们是否正在维护。)

So I download the tarball, extract it, open the MSYS shell from MinGW, go to tools/build/v2 and run bootstrap.sh - this fails, and bootstrap.log reads as follows: 因此,我下载了压缩包,将其解压缩,从MinGW打开MSYS Shell,转到tools / build / v2并运行bootstrap.sh-失败,bootstrap.log如下所示:

###
### Using 'gcc' toolset.
###
rm -rf bootstrap
mkdir bootstrap
gcc -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c pathunix.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c
builtins.c:34:23: fatal error: sys/wait.h: No such file or directory
compilation terminated.
execunix.c:20:26: fatal error: sys/resource.h: No such file or directory
compilation terminated.
fileunix.c:96:17: fatal error: ar.h: No such file or directory
compilation terminated.

As best I can figure, I don't have those files. 尽我所能的身影,我没有这些文件。 (I don't see them in my MinGW install anywhere...) So next I tried bootstrap.sh --with-toolset=mingw (which seems to be a "supported" option...) and it seems to get a little farther before giving a different error. (我在任何地方的MinGW安装中都没有看到它们...)因此,接下来我尝试了bootstrap.sh --with-toolset = mingw(这似乎是“受支持的”选项...),似乎得到了给出其他错误之前,请稍远一点。 Here is the bootstrap.log from that run: 这是该运行的bootstrap.log:

###
### Using 'mingw' toolset.
###
rm -rf bootstrap
mkdir bootstrap
gcc -DNT -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c pathunix.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execnt.c filent.c
./bootstrap/jam0 -f build.jam --toolset=mingw --toolset-root= clean
...found 1 target...
...updating 1 target...
...updated 1 target...
./bootstrap/jam0 -f build.jam --toolset=mingw --toolset-root=
don't know how to make modules/set.c
don't know how to make modules/path.c
don't know how to make modules/regex.c
don't know how to make modules/property-set.c
don't know how to make modules/sequence.c
don't know how to make modules/order.c
...found 126 targets...
...updating 1 target...
...can't find 6 targets...
...can't make 2 targets...
failed to write command file!

I tried to go looking for these files (or where they're supposed to be anyhow) and I can't even find a modules directory anywhere... so I'm pretty stumped on this error. 我试图去寻找这些文件(或者无论如何都应该在哪里),但我什至在任何地方都找不到模块目录...所以我很困惑这个错误。 I can't even tell for sure whether these are generated source files that it is supposed to build but can't for some reason, or are files that are supposed to already exist and it just can't find them (and in the latter case, whether they're supposed to be included with the boost source or supposed to already be on my system somewhere). 我什至无法确定这些文件是否是应该生成但由于某种原因而无法生成的生成的源文件,或者是应该已经存在且无法找到它们的文件(在后者中)情况,无论是应该将它们包含在boost源中还是应该已经存在于我的系统中。

Does anyone know how to fix this error and get boost built? 有谁知道如何解决此错误并获得增强功能? (or at least get Boost.Build built, which is supposed to be the first step towards building boost...?) (或者至少构建Boost.Build,这应该是构建boost的第一步...?)

You shouldn't use MSYS shell. 您不应该使用MSYS Shell。 Make sure g++.exe is on path, and via cmd.exe run 确保g ++。exe在路径上,并通过cmd.exe运行

d:\\Libraries\\Boost\\boost_1_53_0>bootstrap.bat gcc

This should produce b2.exe which can then be used to build (parts of) Boost. 这将产生b2.exe,然后可以将其用于构建Boost(的一部分)。

In my case, since neither bootstrap.bat mingw nor bootstrap.bat gcc generate a correct project-config.jam , ie which does not contain msvc , I ended up changing manually msvc to gcc in project-config.jam . 就我而言,由于bootstrap.bat mingwbootstrap.bat gcc都不会生成正确的project-config.jam ,即其中不包含msvc ,因此我最终在project-config.jam中将msvc手动更改为gcc By the way, mingw didn't do the trick. 顺便说一句, mingw没有成功。

I could have a different behavior due to the first execution of bootstrap and b2 commands which partially built boost libraries with msvc12 compiler. 由于首次执行bootstrapb2命令(它们使用msvc12编译器部分构建了boost库),我可能会有不同的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM