2012-11-15 150 views
12

我無法在Mac OS x 10.8.2上使用ng 3.1編譯boost。編譯boost C++ 11鐺mac找不到cstddef

這是我做過什麼:

./bootstrap.sh --with-toolset=clang 
./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" 

我也試過不計時,測試波信號。 我嘗試了用戶config.jam中與

using clang-darwin 

這是我對幾乎每一個文件中的錯誤:

/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found 

這是一種類似於How to compile/link Boost with clang++/libc++?

謝謝: - )

更新: 我確實安裝了最新的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. 

構建Boost C++庫。

- iconv (libc)    : no 
- iconv (separate)   : yes 
- icu      : no 
- icu (lib64)    : no 

組件配置:

- 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" 
+0

我已經糾正你的標題,將'cstddef.h'改爲'cstddef' –

回答

4

我終於在數小時後解決了我的問題。

家釀亂搞我的路徑,由於某種原因,我的叮噹無法找到libC++頭。

有一個錯誤是提升1.52。

見​​

我不得不編輯文件:

boost/config/stdlib/libcpp.hpp 

和打補丁:

#if _LIBCPP_VERSION < 1002 
# define BOOST_NO_CXX11_NUMERIC_LIMITS 
#endif 

現在提高正常建設中...

+0

Homebrew現在可以選擇使用C++ 11構建boost,boost由homebrew修補:-)。 – Kikohs

+0

只是一個說明,如果你正在與你的項目一起建立提升,我認爲沒有辦法用travis-ci來做到這一點。如果有人找到辦法,讓我知道,但我不認爲有一種方式,由於travis-ci的鏗鏘聲是多麼過時。 –

5

看起來你忘了安裝的libC++頭旁邊鐺。

如果您不想混淆安裝標頭,請嘗試Apple發佈的clang版本作爲命令行工具包的一部分;它已經通過了更多的測試,並且已經正確設置。

+0

我已經安裝了使用開發人員工具使用Xcode。 – Kikohs