1

我正在运行 Windows 7 Enterprise SP1 并尝试设置 C++ 开发环境。我安装了 MinGW,它似乎可以正常工作。接下来,我需要安装 boost... 似乎唯一好的选择是从源代码编译。(我没有看到任何官方的 Windows 二进制文件。我发现了几个非官方的二进制文件,但它们往往比当前版本落后几个版本,并且不清楚它们是否正在维护。)

所以我下载了压缩包,解压它,从 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.

据我所知,我没有这些文件。(我在我的 MinGW 安装中没有看到它们......)所以接下来我尝试了 bootstrap.sh --with-toolset=mingw (这似乎是一个“支持”选项......)它似乎得到了一个在给出不同的错误之前再走一点。这是该运行的 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!

我试图去寻找这些文件(或者无论如何它们应该在哪里),我什至在任何地方都找不到模块目录......所以我很困惑这个错误。我什至无法确定这些是否是它应该构建但由于某种原因不能生成的源文件,或者是应该已经存在但它只是找不到它们的文件(在后者中)情况下,它们是否应该包含在提升源中或应该已经在我的系统上)。

有谁知道如何修复这个错误并获得提升?(或者至少构建 Boost.Build,这应该是构建提升的第一步......?)

4

2 回答 2

5

你不应该使用 MSYS shell。确保 g++.exe 在路径上,并通过 cmd.exe 运行

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

这应该会生成 b2.exe,然后可以使用它来构建(部分)Boost。

于 2013-07-11T19:37:30.673 回答
1

就我而言,由于既不bootstrap.bat mingw也不bootstrap.bat gcc生成正确的project-config.jam,即不包含msvc,我最终手动更改msvcgccin project-config.jam。顺便说一句,mingw没有做的伎俩。

由于第一次执行bootstrapb2使用 msvc12 编译器部分构建 boost 库的命令,我可能会有不同的行为。

于 2013-11-22T23:58:08.483 回答