Kik*_*ohs 14 c++ boost clang c++11
我无法使用Mac OS x 10.8.2上的clang 3.1编译boost.
这就是我做的:
./bootstrap.sh --with-toolset=clang
./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++"
Run Code Online (Sandbox Code Playgroud)
我也试过没有计时,测试,波动和信号.我尝试了一个user-config.jam
using clang-darwin
Run Code Online (Sandbox Code Playgroud)
这是我几乎每个文件都有的错误:
/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found
Run Code Online (Sandbox Code Playgroud)
它有点类似于如何用clang ++/libc ++编译/链接Boost?
谢谢 :-)
更新:我确实安装了最新的Xcode 4.5.2并安装了命令行工具.
这是控制台输出的一部分:
Kikohs:trunk kikohs$ ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++"
Performing configuration checks
- 32-bit : no
- 64-bit : yes
- x86 : yes
- 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
- gcc visibility : yes
- long double support : no
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.
Run Code Online (Sandbox Code Playgroud)
构建Boost C++库.
- iconv (libc) : no
- iconv (separate) : yes
- icu : no
- icu (lib64) : no
Run Code Online (Sandbox Code Playgroud)
组件配置:
- atomic : building
- chrono : building
- context : 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 8672 targets...
...updating 1127 targets...
common.mkdir bin.v2/libs/atomic
common.mkdir bin.v2/libs/atomic/build
common.mkdir bin.v2/libs/atomic/build/clang-darwin-4.2.1
common.mkdir bin.v2/libs/atomic/build/clang-darwin-4.2.1/debug
clang-darwin.compile.c++ bin.v2/libs/atomic/build/clang-darwin-4.2.1/debug/lockpool.o
In file included from libs/atomic/src/lockpool.cpp:1:
./boost/atomic.hpp:10:10: fatal error: 'cstddef' file not found
#include <cstddef>
^
1 error generated.
"clang++" -x c++ -O0 -g -std=c++11 -stdlib=libc++ -O0 -fno-inline -Wall -g -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_ATOMIC_SOURCE -I"." -c -o "bin.v2/libs/atomic/build/clang-darwin-4.2.1/debug/lockpool.o" "libs/atomic/src/lockpool.cpp"
Run Code Online (Sandbox Code Playgroud)
看起来您忘了在clang旁边安装libc ++标头.
如果您不想安装标题,请尝试Apple分发的clang版本作为Command Line Tools包的一部分; 它已通过更多测试,并且已经正确设置.
几个小时后我终于解决了我的问题。
Homebrew 弄乱了我的路径,由于某种原因,我的 clang 找不到 libc++ 标头。
boost 1.52有一个bug。
请参阅Boost 数值限制错误
我必须编辑该文件:
boost/config/stdlib/libcpp.hpp
Run Code Online (Sandbox Code Playgroud)
并修补它:
#if _LIBCPP_VERSION < 1002
# define BOOST_NO_CXX11_NUMERIC_LIMITS
#endif
Run Code Online (Sandbox Code Playgroud)
现在 boost 正在正常构建......