【问题标题】:Setting up Boost on Windows with CodeBlocks使用 CodeBlocks 在 Windows 上设置 Boost
【发布时间】:2013-02-14 14:55:15
【问题描述】:

我想使用 Boost Filesystem 库,并尝试在我的 Windows 机器上安装 Boost。我正在使用 CodeBolcks 进行开发。我做了以下:

1) 我下载并提取了 boost 到:d:\boost_1_53_0

2) 我下载并解压了 jam 可执行文件到:d:\boost-jam-3.1.18-1-ntx86

3) 我在 PATH 环境变量中添加了“d:\boost-jam-3.1.18-1-ntx86”。

4) 我转到“d:\boost_1_53_0”,然后运行以下命令:

bjam --toolset=gcc "--prefix=D:\Program Files\CodeBlocks" install

我得到以下输出:

warning: mismatched versions of Boost.Build engine and core
warning: Boost.Build engine (bjam) is 03.1.18
warning: Boost.Build core (at D:/boost_1_53_0/tools/build/v2) is 2011.12-svn
D:/boost_1_53_0/tools/build/v2/util\path.jam:476: in path.makedirs
rule MAKEDIR unknown in module path.
D:/boost_1_53_0/tools/build/v2/build\configure.jam:190: in configure.set-log-file
D:/boost_1_53_0/tools/build/v2\build-system.jam:725: in load
D:\boost_1_53_0\tools\build\v2/kernel\modules.jam:283: in import
D:\boost_1_53_0\tools\build\v2\kernel\bootstrap.jam:142: in boost-build
D:\boost_1_53_0\boost-build.jam:17: in module scope

有人知道如何解决这个问题吗?

谢谢

更新 1:

根据您的建议,我尝试使用 Boost 文件夹中的 bootstrap.bat。但是,我收到了以下输出:

D:\boost_1_53_0>bootstrap.bat gcc
Building Boost.Build engine

Failed to build Boost.Build engine.
Please consult bootstrap.log for furter diagnostics.

You can try to obtain a prebuilt binary from

   http://sf.net/project/showfiles.php?group_id=7586&package_id=72941

Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.

bootstrap.log 文件包含以下内容:

###
### Using 'gcc' toolset.
###

D:\boost_1_53_0\tools\build\v2\engine>if exist bootstrap rd /S /Q bootstrap 

D:\boost_1_53_0\tools\build\v2\engine>md bootstrap 

D:\boost_1_53_0\tools\build\v2\engine>gcc -DNT -o bootstrap\jam0.exe  command.c compile.c constants.c debug.c execnt.c filent.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 pathunix.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c md5.c pwd.c class.c w32_getreg.c native.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c 

D:\boost_1_53_0\tools\build\v2\engine>.\bootstrap\jam0 -f build.jam --toolset=gcc "--toolset-root= "  clean 
...found 1 target...
...updating 1 target...
...updated 1 target...

D:\boost_1_53_0\tools\build\v2\engine>.\bootstrap\jam0 -f build.jam --toolset=gcc "--toolset-root= "  
...found 50 targets...
...updating 2 targets...
[COMPILE] bin.ntx86\b2.exe

"gcc"   -o bin.ntx86\b2.exe "-DNDEBUG" "-DOPT_HEADER_CACHE_EXT" "-DOPT_GRAPH_DEBUG_EXT" "-DOPT_SEMAPHORE" "-DOPT_AT_FILES" "-DOPT_DEBUG_PROFILE" "-DOPT_FIX_TARGET_VARIABLES_EXT" "-DOPT_IMPROVED_PATIENCE_EXT" "-DNT" "-DYYSTACKSIZE=5000" "-pedantic" "-fno-strict-aliasing" "-s" "-O3" "-Wno-long-long" "command.c" "compile.c" "constants.c" "debug.c" "function.c" "glob.c" "hash.c" "hcache.c" "headers.c" "hdrmacro.c" "jam.c" "jambase.c" "jamgram.c" "lists.c" "make.c" "make1.c" "mem.c" "object.c" "option.c" "output.c" "parse.c" "regexp.c" "rules.c" "scan.c" "search.c" "subst.c" "w32_getreg.c" "timestamp.c" "variable.c" "modules.c" "strings.c" "filesys.c" "builtins.c" "pwd.c" "class.c" "native.c" "md5.c" "modules/set.c" "modules/path.c" "modules/regex.c" "modules/property-set.c" "modules/sequence.c" "modules/order.c" "execnt.c" "filent.c" "pathunix.c" 

...failed [COMPILE] bin.ntx86\b2.exe...
...removing bin.ntx86\b2.exe
...skipped bjam.exe for lack of b2.exe...
...failed updating 1 target...
...skipped 1 target...

你有什么建议?

更新 2:

D:\boost_1_53_0\tools\build\v2>bootstrap.bat gcc
Bootstrapping the build engine

Failed to bootstrap the build engine
Please consult bootstrap.log for furter diagnostics.

bootstrap.log 文件包含与 UPDATE 1 中相同的内容。问题出在哪里?谢谢

【问题讨论】:

  • 你试过从 boost 发行版运行 bootstrap.bat 吗?
  • 你在windows上下载的boost发行版自带构建链,不需要单独安装jam。如您所见,这只会导致问题。
  • @StoryTeller。事实上,我使用了 tools\build\v2\engine 文件夹中的 build.bat,得到的输出与我在 bootstrap.log 中得到的输出相同(消息在我的问题的更新中)。另一方面,“gcc --version”命令给了我版本。
  • @us2012 如果我理解正确,我不需要下载 bjam 可执行文件或下载 bjam 源代码。这听起来很棒。但是,从输出看来,构建 bjam 似乎失败了。如何从 boost 分发文件夹构建 jam?

标签: c++ windows boost codeblocks bjam


【解决方案1】:

您必须从另一个来源(不是 boost tar 发行版附带的那个)安装了 boost.build 包。

如果您想摆脱警告,您需要从与您的 boost 发行版相同的包中安装 boost-build。为了确保它们都是相同的并且是最新的,只需从 here 下载 boost 并解压缩它。完成后按照 boost 的安装说明(基本上是bootstrap 然后b2),进入 tools/build/v2 并执行bootstrap.shb2。然后你会生成这个boost版本对应的b2和bjam文件,不会再有这个警告了。

【讨论】:

    【解决方案2】:

    通过右键单击我的计算机和属性,将 %PATH% 变量设置为 'gcc.exe' 在 envs 变量中的位置,然后重新启动提示符并再次运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多