1

我一直在尝试编译从 boostorg github repo 下载的 c++ boost 库,但出现以下错误。

...updating 968 targets...

darwin.compile.c++ bin.v2/libs/atomic/build/darwin-4.2.1/release/threading-multi/lockpool.o
libs/atomic/src/lockpool.cpp:31: error: expected unqualified-id before numeric constant
libs/atomic/src/lockpool.cpp:31: error: expected `)' before numeric constant
libs/atomic/src/lockpool.cpp:55: error: expected `}' at end of input
libs/atomic/src/lockpool.cpp:55: error: expected `}' at end of input
libs/atomic/src/lockpool.cpp:55: error: expected `}' at end of input
libs/atomic/src/lockpool.cpp:55: error: expected `}' at end of input

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -dynamic -gdwarf-2 -fexceptions -fPIC  -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_ATOMIC_SOURCE -DNDEBUG  -I"." -c -o "bin.v2/libs/atomic/build/darwin-4.2.1/release/threading-multi/lockpool.o" "libs/atomic/src/lockpool.cpp"

...failed darwin.compile.c++ bin.v2/libs/atomic/build/darwin-4.2.1/release/threading-multi/lockpool.o...
...skipped <pstage/lib>libboost_atomic.dylib for lack of <pbin.v2/libs/atomic/build/darwin-4.2.1/release/threading-multi>lockpool.o...
darwin.compile.c++ bin.v2/libs/system/build/darwin-4.2.1/release/threading-multi/error_code.o
darwin.link.dll stage/lib/libboost_system.dylib
darwin.compile.c++ bin.v2/libs/chrono/build/darwin-4.2.1/release/threading-multi/chrono.o
In file included from /usr/local/include/boost/mpl/or.hpp:43,
                 from /usr/local/include/boost/mpl/logical.hpp:17,
                 from /usr/local/include/boost/chrono/duration.hpp:40,
                 from /usr/local/include/boost/chrono/chrono.hpp:11,
                 from /usr/local/include/boost/chrono/detail/inlined/chrono.hpp:13,
                 from libs/chrono/src/chrono.cpp:14:
/usr/local/include/boost/mpl/aux_/include_preprocessed.hpp:37:90: error: boost/mpl/aux_/preprocessed/gcc/or.hpp: No such file or directory
In file included from /usr/local/include/boost/mpl/and.hpp:42,
                 from /usr/local/include/boost/mpl/logical.hpp:18,
                 from /usr/local/include/boost/chrono/duration.hpp:40,
                 from /usr/local/include/boost/chrono/chrono.hpp:11,
                 from /usr/local/include/boost/chrono/detail/inlined/chrono.hpp:13,
                 from libs/chrono/src/chrono.cpp:14:
/usr/local/include/boost/mpl/aux_/include_preprocessed.hpp:37:90: error: boost/mpl/aux_/preprocessed/gcc/and.hpp: No such file or directory
In file included from /usr/local/include/boost/chrono/chrono.hpp:11,
                 from /usr/local/include/boost/chrono/detail/inlined/chrono.hpp:13,
                 from libs/chrono/src/chrono.cpp:14:
/usr/local/include/boost/chrono/duration.hpp:442: error: ‘and_’ is not a member of ‘boost::mpl’

这正是我的做法:

git clone https://github.com/boostorg/boost.git
cd boost
git submodule init
git submodule update
./boostrap.sh
./b2

知道我缺少什么吗?

4

1 回答 1

3

该 github 存储库似乎是将 boost 模块化到单独的 git 存储库的正在进行的工作的一部分。它似乎仍然存在一些问题。如果你想构建最新的开发代码,我会使用官方的 svn trunk:

svn co http://svn.boost.org/svn/boost/trunk boost

如果你只想要最新版本 (1.54) 的源代码,你可以在这里下载

但是如果你特别需要一个 git 镜像,似乎是 boost trunk 的最新镜像。

于 2013-08-16T01:01:02.027 回答