无法使用GCC构建Boost库

无法使用GCC构建Boost库,gcc,boost,bjam,Gcc,Boost,Bjam,我使用的是64位Windows 7,希望从命令行(我不使用MSVC)编译非预编译库(具体来说,我需要文件系统)。我有MinGW,但是在Boost网站上读到msysshell不受支持,所以我试图从Windows命令提示符编译这些库 首先,运行bootstrap.bat会导致以下错误: Building Boost.Jam build engine 'cl' is not recognized as an internal or external command, operable progra

我使用的是64位Windows 7,希望从命令行(我不使用MSVC)编译非预编译库(具体来说,我需要文件系统)。我有MinGW,但是在Boost网站上读到msysshell不受支持,所以我试图从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_根目录中没有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
等等,用大量的
…失败的
语句


这里有什么提示吗

引导脚本假定msvc编译器可用。但您可以手动构建bjam,而无需启动脚本:

进入tools\build\v2\engine\src目录并调用“build.bat mingw”。它将创建一个bjam.exe。然后,您可以将其放在%PATH%或根boost目录中


老实说,我通常使用msvc编译器像这样构建bjam,并使用这个“msvc bjam”来构建我的mingw boost库。

。。。安德烈的建议解决了问题的第一部分。 第二部分是通过将变量BOOST_FILESYSTEM_VERSION设置为3来解决的(上面的错误抱怨与file
user.hpp
中设置的内容不兼容)。虽然这不是我正在使用的Boost 1.45的默认选项,但它是唯一有效的选项(即bjam希望编译版本3)。所以现在我有了文件系统库的版本3,所有其他的都有版本2,但这似乎暂时不是问题


不过,我在OpenCV和Egeng库中使用Boost时确实有问题。。。进入下一个挑战;)

这很容易。只需使用“bootstrap.bat gcc”来选择gcc

,因为我还不能评论,我想添加我运行的

自举mingw

正确生成b2,然后

b2--build dir=“c:\boost\u release”toolset=gcc--build type=complete“c:\boost\u release\stage”


包含文件将位于boost根文件夹(boost_1_58_00/boost)中,二进制文件位于指定的生成文件夹中。

Hi Andre,非常感谢。虽然bjam.exe不能与64位特定标志一起使用,但确实如此。干杯刚刚使用MinGW64处理64位特定的内容。Bjam使用最新版本。现在(BoostV1.63)目录是\tools\build\src\engine。命令是build.bat gcc。bjam.exe和b2.exe位于\tools\build\src\engine\bin.ntx86worked中,但必须将“C:\MinGW\bin”放在Windows的PATH环境变量中并提前重新启动,否则gcc命令未知。
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"