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

Wilhansen Li willi.t1 at gmail.com
Mon Oct 10 07:45:11 PDT 2011


libc++ version: svn rev 141506
clang version: svn rev 141529
boost version: svn/release rev 74889
on Mac OS X 10.6

Hi,

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:

boost::archive::detail::basic_iarchive_impl::load_pointer(boost::archive::detail::basic_iarchive&,
void*&, boost::archive::detail::basic_pointer_iserializer const*,
boost::archive::detail::basic_pointer_iserializer const*
(*)(boost::serialization::extended_type_info const&)) in basic_iarchive.o

boost::archive::detail::basic_oarchive_impl::save_object(boost::archive::detail::basic_oarchive&,
void const*, boost::archive::detail::basic_oserializer const&) in
basic_oarchive.o

boost::archive::detail::basic_oarchive_impl::save_pointer(boost::archive::detail::basic_oarchive&,
void const*, boost::archive::detail::basic_pointer_oserializer const*) in
basic_oarchive.o
      void
boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> > >::load<short>(short&) in
basic_text_iprimitive.o
      void
boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> > >::load<unsigned short>(unsigned short&) in
basic_text_iprimitive.o
      void
boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> > >::load<int>(int&) in basic_text_iprimitive.o
      boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> > >::load_binary(void*, unsigned long) in
basic_text_iprimitive.o
      ...
  "std::__1::__vector_base_common<true>::__throw_length_error() const",
referenced from:

__ZNSt3__16vectorIN5boost7archive6detail19basic_iarchive_impl10cobject_idENS_9allocatorIS5_EEE9push_backEOS5_
in basic_iarchive.o

__ZNSt3__16vectorIN5boost7archive6detail19basic_iarchive_impl7aobjectENS_9allocatorIS5_EEE9push_backEOS5_
in basic_iarchive.o

boost::spirit::classic::chset<wchar_t>::chset(boost::spirit::classic::chset<wchar_t>
const&) in xml_grammar.o
      void
boost::spirit::classic::utility::impl::detach<wchar_t>(boost::shared_ptr<boost::spirit::classic::basic_chset<wchar_t>
>&) in xml_grammar.o

__ZNSt3__16vectorIN5boost6spirit7classic7utility4impl5rangeIwEENS_9allocatorIS7_EEE6insertENS_11__wrap_iterIPKS7_EEOS7_
in xml_grammar.o

boost::spirit::classic::utility::impl::range_run<wchar_t>::set(boost::spirit::classic::utility::impl::range<wchar_t>
const&) in xml_grammar.o

std::__1::vector<boost::spirit::classic::utility::impl::range<wchar_t>,
std::__1::allocator<boost::spirit::classic::utility::impl::range<wchar_t> >
>::insert(std::__1::__wrap_iter<boost::spirit::classic::utility::impl::range<wchar_t>
const*>, boost::spirit::classic::utility::impl::range<wchar_t> const&) in
xml_grammar.o
      ...
  "std::__1::basic_istream<char, std::__1::char_traits<char>
>::operator>>(short&)", referenced from:
      void
boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> > >::load<short>(short&) in
basic_text_iprimitive.o
      void
boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> >
>::load<boost::archive::class_id_type>(boost::archive::class_id_type&) in
text_iarchive.o
  "std::__1::basic_istream<char, std::__1::char_traits<char>
>::operator>>(unsigned short&)", referenced from:
      void
boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> > >::load<unsigned short>(unsigned short&) in
basic_text_iprimitive.o
      void
boost::archive::basic_text_iprimitive<std::__1::basic_istream<char,
std::__1::char_traits<char> >
>::load<boost::archive::library_version_type>(boost::archive::library_version_type&)
in text_iarchive.o

...and a whole lot more

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+++.

Here's a -v output from text_iarchive:

/opt/bin/clang" -cc1 -triple x86_64-apple-macosx10.6.8 -emit-obj
-disable-free -main-file-name basic_iarchive.cpp -pic-level 1
-mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 127.2 -v -coverage-file
bin.v2/libs/serialization/build/clang-darwin-trunk/release/threading-multi/basic_iarchive.o
-resource-dir /opt/bin/../lib/clang/3.0 -U __STRICT_ANSI__ -D
__STDC_FORMAT_MACROS -D BOOST_ALL_NO_LIB=1 -D BOOST_SERIALIZATION_DYN_LINK=1
-D NDEBUG -I . -stdlib=libc++ -fmodule-cache-path
/var/folders/2J/2JQRY1NwFlKXHQSUa2kNCE+++TI/-Tmp-/clang-module-cache -O3
-Wno-inline -Wall -fdeprecated-macro -ferror-limit 19 -fmessage-length 0
-stack-protector 1 -fblocks -fobjc-dispatch-method=mixed -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o
bin.v2/libs/serialization/build/clang-darwin-trunk/release/threading-multi/basic_iarchive.o
-x c++ libs/serialization/src/basic_iarchive.cpp



Regards,
Wil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111010/2485b08f/attachment.html>


More information about the cfe-dev mailing list