gcc - 无法使用 GCC 构建 Boost 库

标签 gcc boost bjam

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

首先,运行 bootstrap.bat 会导致以下错误:

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 文件。

忽略此错误并尝试运行下载的 bjam.exe 文件,我收到另一个错误:
c:/boost_1_45_0/tools/build/v2/build\configure.jam:145: in builds-raw
*** argument error
* rule UPDATE_NOW ( targets * : log ? : ignore-minus-n ? )
* called with: ( <pbin.v2\libs\regex\build\gcc-mingw-4.5.2\debug\address-model64\architecture-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/build\configure.jam:179: in configu
re.builds
c:/boost_1_45_0/tools/build/v2/build\configure.jam:216: in object(
check-target-builds-worker)@409.check

等等,有很多提示。设置“架构”和“地址模型”选项无济于事。

有什么建议?

@安德烈

按照安德烈的建议,我创建了 minGW-bjam,它运行了一个半小时并构建了大部分库,但不是我目前需要的库:文件系统。
尝试仅编译文件系统,使用 define="BOOST_FILESYSTEM_VERSION=2" 指定版本 2和 --disable-filesystem3没有帮助。我收到以下错误:
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-mingw-4.5.2\debug\v3\src\operations.o
In file included from ./boost/filesystem/v3/operations.hpp:24:0,
             from libs\filesystem\v3\src\operations.cpp:48:
./boost/filesystem/v3/config.hpp:16:5: error: #error Compiling Filesystem version 3 
file with BOOST_FILESYSTEM_VERSION defined != 3
libs\filesystem\v3\src\operations.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.v2\libs\filesystem\build\gcc-mingw-4.5.2\debug\v3\src\operations.o"  
"libs\filesystem\v3\src\operations.cpp"

等很多...failed声明。

这里有什么提示吗?

最佳答案

这很简单。只需使用“bootstrap.bat gcc”来选择 GCC

关于gcc - 无法使用 GCC 构建 Boost 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5299468/

相关文章:

c - 在禁用优化的情况下,演示代码无法显示 4 倍快的 SIMD 速度

c++ - 为什么 boost::shared_ptr -> 运算符不是内联声明的?

c++ - 使用 BJam 使用 openssl 构建 libtorrent

c++ - 如何编译 Boost.Process 库?

c++ - 类模板中文字运算符的Friend声明

c++ - boost.graph 1.56.0 和 g++ 4.6.4 编译错误

c++ - BGL : vertices in listS and index_map

c++ - 构建 boost 库的子集

xcode - 为什么 Homebrew 报告 "couldn' t 理解 kern.osversion `14.0.0'”?

c++ - boost::scoped_ptr 指针的值到底是什么?