Hi,
I've updated gcc to this:
gcc (Ubuntu/Linaro 4.5.1-5ubuntu1) 4.5.1
I've recompiled boost with it (and the test) and tried again but with no
luck.
Minimal test looks like: (but throws another exception...)
-----------------------------------------------------------------
#include
#include <cassert>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include
#include
#include
#include
int main(int argc, char **argv) {
if (argc != 2) {
std::cout << "Usage: ser_test " << std::endl;
return -1;
}
std::vectorstd::string t1, t2;
t1.push_back("");
{
std::ofstream ofs;
ofs.exceptions(std::ofstream::badbit | std::ofstream::failbit);
ofs.open(argv[1], std::ios::binary);
boost::archive::binary_oarchive oa(ofs);
oa << t1;
}
{
std::ifstream ifs;
ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit);
ifs.open(argv[1], std::ios::binary);
boost::archive::binary_iarchive ia(ifs);
ia >> t2;
}
unlink(argv[1]);
assert(t1 == t2);
}
--------------------------------------------------------------------------------
and my gdb session looks like:
[druid@druid-desktop tmp]$ g++ -g -O0 -Wall ser_test.cpp -o ser_test
-lboost_serialization
[druid@druid-desktop tmp]$ gdb ./ser_test
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/druid/tmp/ser_test...done.
(gdb) run asdf
Starting program: /home/druid/tmp/ser_test asdf
[Thread debugging using libthread_db enabled]
terminate called after throwing an instance of
'boost::archive::archive_exception'
what(): input stream error
Program received signal SIGABRT, Aborted.
0x00007ffff707fba5 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) i s
#0 0x00007ffff707fba5 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff70836b0 in abort () at abort.c:92
#2 0x00007ffff79230cd in __gnu_cxx::__verbose_terminate_handler() () from
/usr/lib/libstdc++.so.6
#3 0x00007ffff79212e6 in ?? () from /usr/lib/libstdc++.so.6
#4 0x00007ffff7921313 in std::terminate() () from /usr/lib/libstdc++.so.6
#5 0x00007ffff792141e in __cxa_throw () from /usr/lib/libstdc++.so.6
#6 0x00007ffff7bac53d in
boost::archive::basic_binary_iprimitive::load(std::basic_string&) ()
from /usr/lib/libboost_serialization.so.1.44.0
#7 0x000000000040d015 in
boost::archive::load_access::load_primitive (ar=..., t=...) at
//usr/include/boost/archive/detail/iserializer.hpp:107
#8 0x000000000040cf2e in
boost::archive::detail::load_non_pointer_typeboost::archive::binary_iarchive::load_primitive::invoke
(ar=..., t=...)
at //usr/include/boost/archive/detail/iserializer.hpp:362
#9 0x000000000040ce67 in
boost::archive::detail::load_non_pointer_typeboost::archive::binary_iarchive::invoke (ar=..., t=...) at
//usr/include/boost/archive/detail/iserializer.hpp:592
#11 0x000000000040cc9e in
boost::archive::detail::common_iarchiveboost::archive::binary_iarchive::load_overrideboost::archive::binary_iarchive::load_override::load_override
(this=0x7fffffffe120, t=...)
at //usr/include/boost/archive/binary_iarchive_impl.hpp:50
#14 0x000000000040c848 in
boost::archive::detail::interface_iarchiveboost::archive::binary_iarchive::operator>>
::loadboost::archive::binary_iarchive (this=0x7fffffffdca0, ar=...)
at //usr/include/boost/serialization/nvp.hpp:87
#16 0x000000000040c586 in
boost::serialization::access::member_load > (ar=..., t=...,
file_version=0)
at //usr/include/boost/serialization/access.hpp:101
#17 0x000000000040c473 in
boost::serialization::detail::member_loader > >::invoke
(ar=..., t=..., file_version=0) at
//usr/include/boost/serialization/split_member.hpp:54
#18 0x000000000040c371 in
boost::serialization::split_member > (ar=..., t=...,
file_version=0)
at //usr/include/boost/serialization/split_member.hpp:69
#19 0x000000000040c26f in boost::serialization::nvp
::serializeboost::archive::binary_iarchive (this=0x7fffffffdca0, ar=...,
file_version=0) at //usr/include/boost/serialization/nvp.hpp:89
#20 0x000000000040c16a in
boost::serialization::access::serialize > (ar=..., t=...,
file_version=0)
at //usr/include/boost/serialization/access.hpp:118
#21 0x000000000040c067 in
boost::serialization::serialize > (ar=..., t=...,
file_version=0)
at //usr/include/boost/serialization/serialization.hpp:69
#22 0x000000000040bf65 in
boost::serialization::serialize_adl > (ar=..., t=...,
file_version=0)
at //usr/include/boost/serialization/serialization.hpp:128
#23 0x000000000040bdf3 in
boost::archive::detail::load_non_pointer_typeboost::archive::binary_iarchive::load_only::invoke
(ar=..., t=...)
at //usr/include/boost/archive/detail/iserializer.hpp:373
#24 0x000000000040bc9f in
boost::archive::detail::load_non_pointer_typeboost::archive::binary_iarchive::invoke (ar=..., t=...)
at //usr/include/boost/archive/detail/iserializer.hpp:439
#25 0x000000000040bb80 in
boost::archive::load const> (ar=..., t=...)
at //usr/include/boost/archive/detail/iserializer.hpp:592
#26 0x000000000040b9d4 in
boost::archive::detail::common_iarchiveboost::archive::binary_iarchive::load_override (this=0x7fffffffe120, t=...)
at //usr/include/boost/archive/detail/common_iarchive.hpp:66
#27 0x000000000040b699 in
boost::archive::basic_binary_iarchiveboost::archive::binary_iarchive::load_override (this=0x7fffffffe120, t=..., version=0)
at //usr/include/boost/archive/basic_binary_iarchive.hpp:70
#28 0x000000000040b183 in
boost::archive::binary_iarchive_impl const>
(
this=0x7fffffffe120, t=...) at
//usr/include/boost/archive/binary_iarchive_impl.hpp:50
#29 0x000000000040aa58 in
boost::archive::detail::interface_iarchiveboost::archive::binary_iarchive::operator>> (this=0x7fffffffe120, t=...)
at //usr/include/boost/archive/detail/interface_iarchive.hpp:60
#30 0x000000000040a12a in
boost::serialization::stl::archive_input_seq, std::allocator > > >::operator()
(this=0x7fffffffdd5e, ar=..., s=..., v=0, hint=...) at
//usr/include/boost/serialization/collections_load_imp.hpp:64
#31 0x0000000000409b32 in
boost::serialization::stl::load_collection,
boost::serialization::stl::archive_input_seq >,
boost::serialization::stl::reserve_imp
(ar=..., s=...) at
//usr/include/boost/serialization/collections_load_imp.hpp:158
#32 0x0000000000409702 in
boost::serialization::load > (ar=...,
t=...)
at //usr/include/boost/serialization/vector.hpp:65
#33 0x0000000000409437 in
boost::serialization::load > (ar=...,
t=..., file_version=0)
at //usr/include/boost/serialization/vector.hpp:140
#34 0x0000000000409077 in
boost::serialization::free_loader, std::allocator > > >::invoke (ar=..., t=...,
file_version=0) at //usr/include/boost/serialization/split_free.hpp:58
#35 0x0000000000408b0e in
boost::serialization::split_free > (ar=..., t=..., file_version=0)
at //usr/include/boost/serialization/split_free.hpp:74
#36 0x0000000000408801 in
boost::serialization::serialize > (ar=...,
t=..., file_version=0)
at //usr/include/boost/serialization/vector.hpp:151
#37 0x00000000004083f6 in
boost::serialization::serialize_adl > (ar=..., t=..., file_version=0)
at //usr/include/boost/serialization/serialization.hpp:128
#38 0x0000000000407eb4 in
boost::archive::detail::iserializer, std::allocator > > >::load_object_data
(this=0x616750, ar=..., x=0x7fffffffe160, file_version=0) at
//usr/include/boost/archive/detail/iserializer.hpp:188
#39 0x00007ffff7ba61ac in
boost::archive::detail::basic_iarchive::load_object(void*,
boost::archive::detail::basic_iserializer const&) () from
/usr/lib/libboost_serialization.so.1.44.0
#40 0x0000000000407626 in
boost::archive::detail::load_non_pointer_typeboost::archive::binary_iarchive::load_standard::invokeboost::archive::binary_iarchive::invoke > (ar=..., t=...) at
//usr/include/boost/archive/detail/iserializer.hpp:592
#43 0x00000000004071e2 in
boost::archive::detail::common_iarchiveboost::archive::binary_iarchive::load_overrideboost::archive::binary_iarchive::load_override::load_overrideboost::archive::binary_iarchive::operator>>
I hope this is useful.
p.s. I switched to text_archive as preformance isn't critical at my project.
Thanks.
On 9 September 2010 20:21, Robert Ramey wrote:
William Oquendo wrote:
Hi,
I am in Mac Os X, running g++ 4.5 and boost 1.44 . I have tested your
code and it worked without problem. I would like to point out that
recently I had some troubles with serialization, because I compiled
boost with g++ 4.2 but I was compiling my code with g++ 4.5 (because
I needed support for c++0x). Everything works again after recompiling
boost with g++ 4.5.
Best regards,
William
I should also mention (maybe I did already) that I had a problem
with the gcc 4.3.2 and gcc 4.2 shipped with Ubuntu 8.04. I filed
a bug report and no one has responded so it may well be that this
compiler/platform has some problems. Note that I also tested
your example on my MSVC system with no problems.
Robert Ramey
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users