我正在尝试使用clang ++ 3.1构建Boost 1.50.0。我尝试使用默认的darwin工具集安装Boost.Build,但是我遇到了编译器错误。
有没有特别的方法呢?
graeme graeme-pc 13:35:14 /usr/local/boost_1_50_0
$ sudo /usr/local/bin/b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++"
Building the Boost C++ Libraries.
Performing configuration checks
- has_icu builds : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
- iconv (libc) : no
- iconv (separate) : yes
- icu : no
- icu (lib64) : no
- gcc visibility : yes
- long double support : yes
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
Component configuration:
- chrono : building
- date_time : building
- exception : building
- filesystem : building
- graph : building
- graph_parallel : building
- iostreams : building
- locale : building
- math : building
- mpi : building
- program_options : building
- python : building
- random : building
- regex : building
- serialization : building
- signals : building
- system : building
- test : building
- thread : building
- timer : building
- wave : building
...patience...
...patience...
...patience...
...patience...
...found 8583 targets...
...updating 6 targets...
clang-darwin.compile.c++ bin.v2/libs/signals/build/clang-darwin-4.2.1/release/threading-multi/named_slot_map.o
libs/signals/src/named_slot_map.cpp:105:12: error: call to member function 'erase' is ambiguous
groups.erase(group);
~~~~~~~^~~~~
/usr/bin/../lib/c++/v1/map:964:14: note: candidate function
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
^
/usr/bin/../lib/c++/v1/map:966:15: note: candidate function
size_type erase(const key_type& __k)
^
/usr/bin/../lib/c++/v1/map:969:15: note: candidate function not viable: requires 2 arguments, but 1 was provided
iterator erase(const_iterator __f, const_iterator __l)
^
libs/signals/src/named_slot_map.cpp:128:26: error: call to member function 'erase' is ambiguous
if (empty(g)) groups.erase(g++);
~~~~~~~^~~~~
/usr/bin/../lib/c++/v1/map:964:14: note: candidate function
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
^
/usr/bin/../lib/c++/v1/map:966:15: note: candidate function
size_type erase(const key_type& __k)
^
/usr/bin/../lib/c++/v1/map:969:15: note: candidate function not viable: requires 2 arguments, but 1 was provided
iterator erase(const_iterator __f, const_iterator __l)
^
2 errors generated.
"clang++" -x c++ -O3 -std=c++11 -stdlib=libc++ -O3 -finline-functions -Wno-inline -Wall -DBOOST_ALL_NO_LIB=1 -DBOOST_SIGNALS_DYN_LINK=1 -DBOOST_SIGNALS_NO_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/signals/build/clang-darwin-4.2.1/release/threading-multi/named_slot_map.o" "libs/signals/src/named_slot_map.cpp"
...failed clang-darwin.compile.c++ bin.v2/libs/signals/build/clang-darwin-4.2.1/release/threading-multi/named_slot_map.o...
...skipped <pstage/lib>libboost_signals.dylib for lack of <pbin.v2/libs/signals/build/clang-darwin-4.2.1/release/threading-multi>named_slot_map.o...
clang-darwin.compile.c++ bin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi/named_slot_map.o
libs/signals/src/named_slot_map.cpp:105:12: error: call to member function 'erase' is ambiguous
groups.erase(group);
~~~~~~~^~~~~
/usr/bin/../lib/c++/v1/map:964:14: note: candidate function
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
^
/usr/bin/../lib/c++/v1/map:966:15: note: candidate function
size_type erase(const key_type& __k)
^
/usr/bin/../lib/c++/v1/map:969:15: note: candidate function not viable: requires 2 arguments, but 1 was provided
iterator erase(const_iterator __f, const_iterator __l)
^
libs/signals/src/named_slot_map.cpp:128:26: error: call to member function 'erase' is ambiguous
if (empty(g)) groups.erase(g++);
~~~~~~~^~~~~
/usr/bin/../lib/c++/v1/map:964:14: note: candidate function
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
^
/usr/bin/../lib/c++/v1/map:966:15: note: candidate function
size_type erase(const key_type& __k)
^
/usr/bin/../lib/c++/v1/map:969:15: note: candidate function not viable: requires 2 arguments, but 1 was provided
iterator erase(const_iterator __f, const_iterator __l)
^
2 errors generated.
"clang++" -x c++ -O3 -std=c++11 -stdlib=libc++ -O3 -finline-functions -Wno-inline -Wall -DBOOST_ALL_NO_LIB=1 -DBOOST_SIGNALS_NO_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi/named_slot_map.o" "libs/signals/src/named_slot_map.cpp"
...failed clang-darwin.compile.c++ bin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi/named_slot_map.o...
...skipped <pbin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi>libboost_signals.a(clean) for lack of <pbin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi>named_slot_map.o...
...skipped <pbin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi>libboost_signals.a for lack of <pbin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi>named_slot_map.o...
...skipped <pstage/lib>libboost_signals.a for lack of <pbin.v2/libs/signals/build/clang-darwin-4.2.1/release/link-static/threading-multi>libboost_signals.a...
...failed updating 2 targets...
...skipped 4 targets...
答案 0 :(得分:7)
看起来是clang ++和Boost 1.50的已知构建问题,其中启用了C ++ 11
您可以通过不构建信号来解决问题。以下步骤对我有用:
$ cd /usr/local/boost_1_50_0
$ sudo ./bootstrap.sh --with-toolset=clang
$ sudo ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" --without-signals