i'm trying to compile boost 1.57 from source on OSX 10.10.5 but seems to fail to build "thread" lib.
OSX 10.10.5 Yosemite
Xcode 6.1
here is compiling command "
$ ./b2 toolset=clang cxxflags="-arch x86_64 -std=c++11 -stdlib=libstdc++ -ftemplate-depth=512" linkflags="-stdlib=libstdc++" link=static install --with-program_options --with-system --with-filesystem --with-chrono --with-thread
Error :
clang-darwin.compile.c++ bin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi/pthread/thread.o
In file included from libs/thread/src/pthread/thread.cpp:11:
In file included from ./boost/thread/thread_only.hpp:17:
In file included from ./boost/thread/pthread/thread_data.hpp:11:
In file included from ./boost/thread/lock_guard.hpp:12:
./boost/thread/detail/move.hpp:31:10: fatal error: 'type_traits' file not found
#include <type_traits>
^
1 error generated.
"clang++" -x c++ -Wextra -Wno-long-long -Wno-variadic-macros -Wunused-function -arch x86_64 -std=c++11 -stdlib=libstdc++ -ftemplate-depth=512 -O3 -O3 -finline-functions -Wno-inline -Wall -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi/pthread/thread.o" "libs/thread/src/pthread/thread.cpp"
...failed clang-darwin.compile.c++ bin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi/pthread/thread.o...
clang-darwin.compile.c++ bin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi/pthread/once.o
In file included from libs/thread/src/pthread/once.cpp:8:
In file included from libs/thread/src/pthread/./once_atomic.cpp:9:
In file included from ./boost/thread/once.hpp:20:
In file included from ./boost/thread/pthread/once_atomic.hpp:16:
./boost/thread/detail/move.hpp:31:10: fatal error: 'type_traits' file not found
#include <type_traits>
^
1 error generated.
"clang++" -x c++ -Wextra -Wno-long-long -Wno-variadic-macros -Wunused-function -arch x86_64 -std=c++11 -stdlib=libstdc++ -ftemplate-depth=512 -O3 -O3 -finline-functions -Wno-inline -Wall -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi/pthread/once.o" "libs/thread/src/pthread/once.cpp"
...failed clang-darwin.compile.c++ bin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi/pthread/once.o...
...skipped <pbin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi>libboost_thread.a(clean) for lack of <pbin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi>pthread/thread.o...
...skipped <pbin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi>libboost_thread.a for lack of <pbin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi>pthread/thread.o...
...skipped <p/usr/local/lib>libboost_thread.a for lack of <pbin.v2/libs/thread/build/clang-darwin-4.2.1/release/link-static/threading-multi>libboost_thread.a...
...failed updating 2 targets...
...skipped 3 targets...
What do you think is the problem ?
I am a latecomer to the party but I have ran into the same issue and the problem is that you want to build it with C++11 but not with libc++.
It looks like that the older version of C++11 implementations were patchy. The libstdc++ is missing the type_traits header, as simple as that. Use the -stdlib=libc++ switch and you should be sorted.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.