我正在运行Windows 7企业SP1,并试图建立一个C++开发环境。我安装了mingw,它似乎可以自己正常工作。接下来,我需要安装boost…似乎唯一好的选择是从源代码编译。(我没有看到任何官方的windows二进制文件。我发现了几个非官方版本,但它们往往落后于当前的几个版本,不清楚它们是否得到了维护。)
所以我下载tarball,提取它,从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——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源中还是应该包含在boost源中已经在我的系统里了。
有人知道如何修复这个错误并构建boost吗?(或者至少得到提振。建设,这应该是建设提振的第一步…?)
最佳答案
你不应该用MSYS外壳。确保g++.exe位于路径上,并通过cmd.exe运行d:\Libraries\Boost\boost_1_53_0>bootstrap.bat gcc
这将产生b2.exe,然后可以用来构建(部分)boost。
关于windows - 在Windows 7上使用MinGW编译boost之前,如何构建Boost.Build?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17583274/