Linking problems with boost serialization and MinGW

Hi, I am having a bit of trouble linking to boost serialization with MinGW. If I don't include -lboost_serialization-mgw46-mt-d-1_50 I get loads of undefined references, however, if I do include it, most disappear but I still get some, namely I get RDebug/libFlamLib.a(Common_Collector.o): In function `ZN5boost7archive21basic_text_oprimitiveISoE4saveINS0_14object_id_typeEEEvRKT_': /Sys/boost/MinGW32/boost_1_50_0/include/boost-1_50/boost/archive/basic_text_oprimitive.hpp:89: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)' RDebug/libFlamLib.a(Common_Collector.o): In function `ZN5boost7archive21basic_text_oprimitiveISoE4saveINS0_21object_reference_typeEEEvRKT_': /Sys/boost/MinGW32/boost_1_50_0/include/boost-1_50/boost/archive/basic_text_oprimitive.hpp:89: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)' RDebug/libFlamLib.a(Common_Collector.o): In function `ZN5boost7archive21basic_text_oprimitiveISoE4saveINS0_13class_id_typeEEEvRKT_': /Sys/boost/MinGW32/boost_1_50_0/include/boost-1_50/boost/archive/basic_text_oprimitive.hpp:89: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)' RDebug/libFlamLib.a(Common_Collector.o): In function `ZN5boost7archive21basic_text_oprimitiveISoE4saveINS0_23class_id_reference_typeEEEvRKT_': /Sys/boost/MinGW32/boost_1_50_0/include/boost-1_50/boost/archive/basic_text_oprimitive.hpp:89: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)' RDebug/libFlamLib.a(Common_Collector.o): In function `ZN5boost7archive21basic_text_oprimitiveISoE4saveINS0_13tracking_typeEEEvRKT_': /Sys/boost/MinGW32/boost_1_50_0/include/boost-1_50/boost/archive/basic_text_oprimitive.hpp:89: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)' RDebug/libFlamLib.a(Common_Collector.o):/Sys/boost/MinGW32/boost_1_50_0/include/boost-1_50/boost/archive/basic_text_oprimitive.hpp:89: more undefined references to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)' follow Basically they all refer to "`boost::archive::archive_exception::archive_exception". boost serialization built fine with .\b2.exe --prefix=c:\Sys\boost\MinGW32\boost_1_50_0 toolset=gcc address-model=32 --with-serialization install The same code compiles and links just fine with gcc on linux and MSVC on windows. I haven't isolate the issue yet, so am afraid can't give a reproducible sample, but any ideas so far? Maybe look familiar? Thanks, Florian

I have isolated the issue. Following code, compiled as a shared library,
fails to compile on MinGW (and does on MSVC):
#include

Hi Florian, On Thursday, 1. November 2012 10:40:39 Florian Burkart wrote:
#include
struct Test { template<class Archive> void serialize(Archive& ar, const unsigned int) { ar & a; } void SerializeToFile(std::ostream& ostream) const { boost::archive::text_oarchive myar(ostream); myar & boost::serialization::make_nvp("test",this); } double a; };
Works with current trunk: Creating library file: E: \Home\hunold\src\devel\boost\bin.v2\libs\serialization\build\gcc- mingw-4.6\debug\libboost_serialization-mgw46-mt-d-1_52.dll.a gcc.link.dll bin\gcc-mingw-4.6\debug\liblinks.dll.a Creating library file: bin\gcc-mingw-4.6\debug\liblinks.dll.a This is using E:\Home\hunold\src\test\seria>g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=e:/home/hunold/mingw32/bin/../libexec/gcc/i686-w64- mingw32/4.6.3/lto-wrapper.exe Target: i686-w64-mingw32 Configured with: /home/ruben/mingw-w64/toolchain/src/gcc/configure --host=i686- w64-mingw32 --build=x86_64-linux-gnu --target=i686- w64-mingw32 --with-sysroot=/home/ruben/mingw- w64/toolchain/mingw32mingw32/mingw32 --prefix=/home/ruben/mingw- w64/toolchain/mingw32 mingw32/mingw32 --with-libiconv-prefix=/home/ruben/mingw- w64/toolchain/mingw32mingw32/prereq_install --with-gmp=/home/ruben/mingw- w64/toolchain/mingw32mingw32/prereq_install --with-mpfr=/home/ruben/mingw- w64/toolchain/mingw32mingw32/prereq_install --with-mpc=/ home/ruben/mingw-w64/toolchain/mingw32mingw32/prereq_install --with- ppl=/home/ruben/mingw-w64/toolchain/mingw32mingw32/prereq_inst all --with-cloog=/home/ruben/mingw-w64/toolchain/mingw32mingw32/prereq_install --enable-cloog-backend=isl --with-host-libstdcxx='- lstdc++ -lm -lgcc_eh' --enable-shared --enable-static --enable-threads=posix --disable-multilib --enable-languages=c,lto,c++,fortr an,objc,obj-c++,java --enable-libgomp --enable-sjlj-exceptions --enable-fully- dynamic-string --disable-nls --disable-werror --enab le-checking=release --disable-win32-registry --disable-rpath --disable-werror CFLAGS='-O2 -mtune=core2 -fomit-frame-pointer -momit -leaf-frame-pointer -fgraphite-identity -floop-interchange -floop-block -floop- parallelize-all' LDFLAGS= Thread model: posix gcc version 4.6.3 20111208 (prerelease) (GCC) This is Ruben van Boxems personal build of gcc-4.6.3 for mingw-w64. Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold@gmx.eu ! Germany

Hi Jürgen, Thanks for doing that. I gave in and just compiled both boost and my libraries with rubenvb's personal build - which worked after some more code porting. A lot of boost libraries didn't compile any more using that build and address model 32 bit though, so I gave up on those and limited myself to 64 bit only for the moment. Thanks for help! Florian
participants (2)
-
Florian Burkart
-
Jürgen Hunold