无法使用 GCC 构建 Boost 库 [英] Unable to build Boost libraries with GCC

查看:62
本文介绍了无法使用 GCC 构建 Boost 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 64 位 Windows 7,并且想从命令行(我不使用 MSVC)编译非预编译库(具体来说,我需要 Filesystem).我有 MinGW,但在 Boost 网站上读到不支持 MSYS shell,所以我试图从 Windows 命令提示符编译库.

I am using Windows 7 64-bit, and want to compile the non-precompiled libraries (specifically, I need Filesystem) from the command line (I do not use MSVC). I have MinGW, but read on the Boost website that MSYS shell is not supported, so I'm trying to compile the libraries from the Windows command prompt.

首先,运行bootstrap.bat会出现如下错误:

First of all, running bootstrap.bat results in the following error:

Building Boost.Jam build engine 
'cl' is not recognized as an internal or external command, 
operable program or batch file. 

Failed to build Boost.Jam build engine. 
Please consult bjam.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 bjam.log in that case. 

另外,boost_root 目录中的任何位置都没有 bjam.log 文件.

Plus, there is not bjam.log file anywhere in the boost_root directory.

忽略这个错误,并尝试运行下载的 bjam.exe 文件,我得到另一个错误:

Disregarding this error, and trying to run the downloaded bjam.exe file, I get another error:

c:/boost_1_45_0/tools/build/v2/buildconfigure.jam:145: in builds-raw
*** argument error
* rule UPDATE_NOW ( targets * : log ? : ignore-minus-n ? )
* called with: ( <pbin.v2libs
egexuildgcc-mingw-4.5.2debugaddress-model64architecture-x86>has_icu.exe :  : ignore-minus-n : ignore-minus-q )
* extra argument ignore-minus-q
(builtin):see definition of rule 'UPDATE_NOW' being called
c:/boost_1_45_0/tools/build/v2/buildconfigure.jam:179: in configu
re.builds
c:/boost_1_45_0/tools/build/v2/buildconfigure.jam:216: in object(
check-target-builds-worker)@409.check

等等.有相当多的抱怨.设置架构"和地址模型"选项无济于事.

etc. with quite a lot of complaints. Setting the 'architecture' and 'address-model' options doesn't help.

有什么建议吗?

@安德烈

按照 Andre 的建议,我创建了运行一个半小时的 minGW-bjam,并构建了大部分库,但不是我目前需要的库:文件系统.尝试仅编译文件系统,使用 define="BOOST_FILESYSTEM_VERSION=2"--disable-filesystem3 指定版本 2 无济于事.我收到以下错误:

Following Andre's suggestion, I created minGW-bjam that was running for an hour and a half and built most of the libraries, but not the one I need at this moment: Filesystem. Trying to compile only Filesystem, specifying version 2 with define="BOOST_FILESYSTEM_VERSION=2" and --disable-filesystem3 does not help. I get the following error:

gcc.compile.c++ bin.v2libsfilesystemuildgcc-mingw-4.5.2debugv3srcoperations.o
In file included from ./boost/filesystem/v3/operations.hpp:24:0,
             from libsfilesystemv3srcoperations.cpp:48:
./boost/filesystem/v3/config.hpp:16:5: error: #error Compiling Filesystem version 3 
file with BOOST_FILESYSTEM_VERSION defined != 3
libsfilesystemv3srcoperations.cpp:647:26: warning: 
'<unnamed>::create_symbolic_link_api' defined but not used

"g++"  -ftemplate-depth-128 -O0 -fno-inline -Wall -g -DBOOST_ALL_NO_LIB=1 -
DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_FILESYSTEM_VERSION=2 -DBOOST_SYSTEM_DYN_LINK=1  -
I"." -c -o "bin.v2libsfilesystemuildgcc-mingw-4.5.2debugv3srcoperations.o"  
"libsfilesystemv3srcoperations.cpp"

等等.有很多 ...failed 语句.

etc. with a lot of ...failed statements.

这里有什么提示吗?

推荐答案

引导脚本假定 msvc 编译器可用.但是您可以在没有引导脚本的情况下手动构建 bjam:

The bootstrap script assumes the msvc compiler is available. But you can build bjam by hand without the bootstrap script:

进入toolsuildv2enginesrc目录,调用build.bat mingw".它将创建一个 bjam.exe.然后你可以把它放在你的 %PATH% 或者 root boost 目录中......

Step into the toolsuildv2enginesrc directory and call "build.bat mingw". It will create a bjam.exe. You can then put it in your %PATH% or perhaps in the root boost directory...

老实说,我通常使用 msvc 编译器构建这样的 bjam,并使用这个msvc-bjam"来构建我的 mingw boost 库.

To be honest, I usually build bjam like this with the msvc compiler and use this "msvc-bjam" to build my mingw boost libraries.

这篇关于无法使用 GCC 构建 Boost 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆