[cfe-dev] Compiling Boost.Serialization with libc++

Jonathan Sauer jonathan.sauer at gmx.de
Mon Oct 10 08:09:33 PDT 2011

> I'm trying to compile boost (boost.serialization in particular) with clang/libc++. The compilation seems fine, however, come the linking, I get these errors:
> clang-darwin.link.dll bin.v2/libs/serialization/build/clang-darwin-trunk/release/threading-multi/libboost_serialization.dylib
> Undefined symbols for architecture x86_64:
>   "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
> The build flags are "-std=c++0x -U__STRICT_ANSI__ -D__STDC_FORMAT_MACROS -stdlib=libc++" and I get the same errors even when I disable c++0x and no errors when I fallback to libstdc+++.

I would guess that you're not linking against libc++, i.e. you're missing -lc++. clang, when called as "clang" instead
of "clang++", does not automatically link against the C++ standard library, at least not when it's libc++(?)

Hope that helps,

More information about the cfe-dev mailing list