|
Boost : |
Subject: Re: [boost] [utf8_codecvt_facet]
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2013-01-05 20:07:19
On Dec 11, 2012, at 9:09 AM, Robert Ramey <ramey_at_[hidden]> wrote:
> I've had trouble setting up GDB for this test. This would be my normal approach.
Ok - here's what I've found:
Here's the crash: (mac os X, gcc library 4.2.1):
> Breakpoint 1, 0x00007fff844e3558 in malloc_error_break ()
> (gdb) bt
> #0 0x00007fff844e3558 in malloc_error_break ()
> #1 0x00007fff844ec809 in szone_error ()
> #2 0x00007fff844ed374 in small_free_list_remove_ptr ()
> #3 0x00007fff844eb013 in szone_free_definite_size ()
> #4 0x00007fff844e4898 in free ()
> #5 0x00007fff821b597f in std::basic_filebuf<wchar_t, std::char_traits<wchar_t> >::_M_destroy_internal_buffer ()
> #6 0x00007fff821b54eb in std::basic_filebuf<wchar_t, std::char_traits<wchar_t> >::close ()
> #7 0x00007fff821b5440 in std::basic_filebuf<wchar_t, std::char_traits<wchar_t> >::~basic_filebuf ()
> #8 0x00007fff821b753a in std::basic_ifstream<wchar_t, std::char_traits<wchar_t> >::~basic_ifstream ()
> #9 0x00007fff821b74cf in std::basic_ifstream<wchar_t, std::char_traits<wchar_t> >::~basic_ifstream ()
> #10 0x0000000100003552 in test_array<A> () at test_array.cpp:109
> #11 0x0000000100001b11 in test_main () at test_array.cpp:117
> #12 0x00000001000019e7 in main (argc=1, argv=0x7fff5fbff720) at test_tools.hpp:203
>
You can see that it's destructing a std::basic_ifstream.
If I strip a bunch of stuff out of test_array.cpp, the crash doesn't happen.
> {
> T a_array1[9];
> test_istream is(testfile, TEST_STREAM_FLAGS);
> BOOST_TRY {
> #if 0
> test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
> bool exception_invoked = false;
> BOOST_TRY {
> ia >> boost::serialization::make_nvp("a_array", a_array1);
> }
> BOOST_CATCH (boost::archive::archive_exception ae){
> BOOST_CHECK(
> boost::archive::archive_exception::array_size_too_short
> == ae.code
> );
> exception_invoked = true;
> }
> BOOST_CATCH_END
> BOOST_CHECK(exception_invoked);
> #endif
> }
> BOOST_CATCH (boost::archive::archive_exception ae){}
> BOOST_CATCH_END
> }
>
If I include the line:
> test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
then it does.
This suggests to me that something in the test_iarchive is poking at the test_istream - but I don't know what.
I tried to extract this into a simple test case (attached), but I can't figure out what to link against for the wide case.
clang++ junk.cpp -DNARROW -I /Sources/boost/trunk -L $BUILD/libs/serialization/$TAIL -lboost_serialization # works
clang++ junk.cpp -I /Sources/boost/trunk -L $BUILD/libs/serialization/$TAIL -lboost_wserialization # does not
For the narrow case, I link against lib boost_serialization, and everything is good.
For the wide case, when I link against boost_wserialization, I get the following errors:
> Undefined symbols for architecture x86_64:
> "boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)", referenced from:
> boost::archive::basic_binary_iprimitive<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::load_binary(void*, unsigned long) in junk-Sgu7RU.o
> "boost::archive::archive_exception::~archive_exception()", referenced from:
> _main in junk-Sgu7RU.o
> boost::archive::basic_binary_iprimitive<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::load_binary(void*, unsigned long) in junk-Sgu7RU.o
> void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&) in junk-Sgu7RU.o
> "boost::archive::basic_binary_iarchive<boost::archive::binary_wiarchive>::load_override(boost::archive::class_name_type&, int)", referenced from:
> void boost::archive::binary_iarchive_impl<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::load_override<boost::archive::class_name_type>(boost::archive::class_name_type&, int) in junk-Sgu7RU.o
> "boost::archive::basic_binary_iarchive<boost::archive::binary_wiarchive>::init()", referenced from:
> boost::archive::binary_iarchive_impl<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::init(unsigned int) in junk-Sgu7RU.o
> "boost::archive::basic_binary_iprimitive<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::init()", referenced from:
> boost::archive::binary_iarchive_impl<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::init(unsigned int) in junk-Sgu7RU.o
> "boost::archive::basic_binary_iprimitive<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::basic_binary_iprimitive(std::basic_streambuf<wchar_t, std::char_traits<wchar_t> >&, bool)", referenced from:
> boost::archive::binary_iarchive_impl<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::binary_iarchive_impl(std::basic_istream<wchar_t, std::char_traits<wchar_t> >&, unsigned int) in junk-Sgu7RU.o
> "boost::archive::basic_binary_iprimitive<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::~basic_binary_iprimitive()", referenced from:
> boost::archive::binary_iarchive_impl<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::~binary_iarchive_impl() in junk-Sgu7RU.o
> boost::archive::binary_iarchive_impl<boost::archive::binary_wiarchive, wchar_t, std::char_traits<wchar_t> >::binary_iarchive_impl(std::basic_istream<wchar_t, std::char_traits<wchar_t> >&, unsigned int) in junk-Sgu7RU.o
> "boost::archive::detail::basic_iarchive::basic_iarchive(unsigned int)", referenced from:
> boost::archive::detail::common_iarchive<boost::archive::binary_wiarchive>::common_iarchive(unsigned int) in junk-Sgu7RU.o
> "boost::archive::detail::basic_iarchive::~basic_iarchive()", referenced from:
> boost::archive::detail::common_iarchive<boost::archive::binary_wiarchive>::~common_iarchive() in junk-Sgu7RU.o
> boost::archive::detail::common_iarchive<boost::archive::binary_wiarchive>::common_iarchive(unsigned int) in junk-Sgu7RU.o
> "boost::archive::detail::basic_iarchive::get_library_version() const", referenced from:
> boost::archive::basic_binary_iarchive<boost::archive::binary_wiarchive>::load_override(boost::archive::tracking_type&, int) in junk-Sgu7RU.o
> boost::archive::basic_binary_iarchive<boost::archive::binary_wiarchive>::load_override(boost::archive::class_id_type&, int) in junk-Sgu7RU.o
> boost::archive::basic_binary_iarchive<boost::archive::binary_wiarchive>::load_override(boost::archive::version_type&, int) in junk-Sgu7RU.o
> "typeinfo for boost::archive::archive_exception", referenced from:
> GCC_except_table1 in junk-Sgu7RU.o
> void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&) in junk-Sgu7RU.o
> "typeinfo for boost::archive::detail::basic_iarchive", referenced from:
> typeinfo for boost::archive::detail::common_iarchive<boost::archive::binary_wiarchive> in junk-Sgu7RU.o
> "vtable for boost::archive::archive_exception", referenced from:
> boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&) in junk-Sgu7RU.o
> NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
> ld: symbol(s) not found for architecture x86_64
>
Can you tell me how to solve this?
-- Marshall
Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk