c++ - Memory access violation when using Boost::Serialization -
i'm trying serializations using boost's serialization library, fail same unhelpful runtime error. say, example, have simple struct:
struct test { unsigned int value; template<class archive> void serialize(archive & ar, unsigned int const version) { ar & boost_serialization_nvp(value); } };
this compiles fine. i'm doing round trip of saving object of test
type archive , loading again.
boost_auto_test_case(test_serialization) { test a{42}; stringstream ss; text_oarchive oa(ss); oa << boost_serialization_nvp(a); } // ... lots of other tests pass fine
this compiles fine. however, following error when running suite.
entering test case "test_serialization" unknown location(0): fatal error in "test_serialization": memory access violation @ address: 0x00000038: no mapping @ fault address test aborted
all other tests except involving serialization run expected.
what cause problem?
my settings:
ubuntu 14.04 boost 1.57 / boost 1.58 clang 3.4 / gcc 4.8.2
building -lboost_serialization -lboost_unit_test_framework
.
since had multiple boost installations, boost headers included version 1.57/1.58, while libboost_serialization.so
library version 1.54.
i recompiled -l/actual/latest/boost/lib/path -lboost_serialization -lboost_unit_test_framework
, , worked.