在windows中使用cygwin64终端构建Boost1.61.0

Build Boost1.61.0 with cygwin64 terminal in windows

本文关键字:构建 Boost1 终端 cygwin64 windows      更新时间:2023-10-16

我今天尝试在windows10中使用cygwin64终端构建boost1.61.0的二进制文件。我按照boost官方指示一步一步,一切正常运行,直到最后一步 ./b2 install然后系统返回如下错误信息:

/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/kernel/modules.jam:107: in modules.call-in
ERROR: rule "<abi>ms" unknown in root module.
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/util/indirect.jam:98: in indirect.call
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/build/targets.jam:1054: in evaluate-requirements
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/build/targets.jam:1112: in common-properties2
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/build/targets.jam:977: in targets.common-properties
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/build/targets.jam:1303: in alias-target-class.generate
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0
/boostcpp.jam:432: in build-multiple
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0
/boostcpp.jam:394: in class@top-level-target.generate
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/build/targets.jam:774: in generate-really
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/build/targets.jam:746: in class@main-target.generate
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/build-system.jam:714: in load
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/kernel/modules.jam:295: in import
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/tools
/build/src/kernel/bootstrap.jam:139: in boost-build
/cygdrive/d/cygwin64/bin/%HOMEDRIVE%%HOMEPATH%/boost_1_61_0/
boost-build.jam:17: in module scope

这是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 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 pathunix.c
./bootstrap/jam0 -f build.jam --toolset=gcc --toolset-root= clean
...found 1 target...
...updating 1 target...
[DELETE] clean
...updated 1 target...
./bootstrap/jam0 -f build.jam --toolset=gcc --toolset-root=
...found 158 targets...
...updating 2 targets...
[COMPILE] bin.cygwinx86_64/b2.exe
[COPY] bin.cygwinx86_64/bjam.exe
...updated 2 targets...

cygwin64的版本是4.9.3

谁能告诉我发生了什么以及如何纠正它?谢谢你的帮助。

我一直在使用boost,但我从来不需要安装它。所以我要建议我的方式,你可以挑选(注意,我通常使用msvc编译器,所以我用gcc为你替换了每个msvc,如果我错了,请纠正我。如果您想使用msvc,请记住运行msvc命令提示符或在任何内容之前运行vcvarsall.bat:

你运行bootstrap:

bootstrap.bat gcc

然后编译:

b2 --build-type=complete stage runtime-link=static --toolset=gcc

是否要静态是你的选择。现在,您创建一个符号链接到您想要的位置。不需要在任何地方安装

由于在Windows中创建符号链接很麻烦,所以我打包了一些软件,只需右键单击就可以轻松创建符号链接。