Opened 12 years ago

Closed 12 years ago

#4375 closed Bugs (fixed)

[serialization] Build failures on Mingw

Reported by: rwebb <richard.webb@…> Owned by: Robert Ramey
Milestone: Boost 1.44.0 Component: serialization
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Most of the serialization tests are failing on Mingw (see the RW_Mingw45 runner on http://www.boost.org/development/tests/trunk/developer/serialization.html).

The test results don't tell you whats failing, but the actual log shows that it's a linking error when building the lib as a .dll:

Creating library file: bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\libboost_serialization-mgw45-mt-1_44.dll.abin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\basic_serializer_map.o:basic_serializer_map.cpp:(.text+0x17): undefined reference to `_imp___ZNK5boost13serialization18extended_type_infoltERKS1_'
bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\basic_serializer_map.o:basic_serializer_map.cpp:(.text+0xb1): undefined reference to `_imp___ZNK5boost13serialization18extended_type_infoltERKS1_'
bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\basic_serializer_map.o:basic_serializer_map.cpp:(.text+0xf2): undefined reference to `_imp___ZNK5boost13serialization18extended_type_infoltERKS1_'
bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\basic_serializer_map.o:basic_serializer_map.cpp:(.text$_ZNSt8_Rb_treeIPKN5boost7archive6detail16basic_serializerES5_St9_IdentityIS5_ENS2_20basic_serializer_map25type_info_pointer_compareESaIS5_EE16_M_insert_uniqueERKS5_[std::_Rb_tree<boost::archive::detail::basic_serializer const*, boost::archive::detail::basic_serializer const*, std::_Identity<boost::archive::detail::basic_serializer const*>, boost::archive::detail::basic_serializer_map::type_info_pointer_compare, std::allocator<boost::archive::detail::basic_serializer const*> >::_M_insert_unique(boost::archive::detail::basic_serializer const* const&)]+0x22): undefined reference to `_imp___ZNK5boost13serialization18extended_type_infoltERKS1_'
bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\basic_serializer_map.o:basic_serializer_map.cpp:(.text$_ZNSt8_Rb_treeIPKN5boost7archive6detail16basic_serializerES5_St9_IdentityIS5_ENS2_20basic_serializer_map25type_info_pointer_compareESaIS5_EE16_M_insert_uniqueERKS5_[std::_Rb_tree<boost::archive::detail::basic_serializer const*, boost::archive::detail::basic_serializer const*, std::_Identity<boost::archive::detail::basic_serializer const*>, boost::archive::detail::basic_serializer_map::type_info_pointer_compare, std::allocator<boost::archive::detail::basic_serializer const*> >::_M_insert_unique(boost::archive::detail::basic_serializer const* const&)]+0x72): undefined reference to `_imp___ZNK5boost13serialization18extended_type_infoltERKS1_'
bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\basic_serializer_map.o:basic_serializer_map.cpp:(.text$_ZNSt8_Rb_treeIPKN5boost7archive6detail16basic_serializerES5_St9_IdentityIS5_ENS2_20basic_serializer_map25type_info_pointer_compareESaIS5_EE16_M_insert_uniqueERKS5_[std::_Rb_tree<boost::archive::detail::basic_serializer const*, boost::archive::detail::basic_serializer const*, std::_Identity<boost::archive::detail::basic_serializer const*>, boost::archive::detail::basic_serializer_map::type_info_pointer_compare, std::allocator<boost::archive::detail::basic_serializer const*> >::_M_insert_unique(boost::archive::detail::basic_serializer const* const&)]+0x15e): more undefined references to `_imp___ZNK5boost13serialization18extended_type_infoltERKS1_' follow
bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\shared_ptr_helper.o:shared_ptr_helper.cpp:(.text+0x50): undefined reference to `_imp___ZN5boost13serialization13void_downcastERKNS0_18extended_type_infoES3_PKv'
bin.v2\libs\serialization\build\gcc-mingw-4.5.0\release\threading-multi\shared_ptr_helper.o:shared_ptr_helper.cpp:(.text+0x107): undefined reference to `_imp___ZN5boost13serialization11void_upcastERKNS0_18extended_type_infoES3_PKv
'
collect2: ld returned 1 exit status

The attached patch adds a #define BOOST_SERIALIZATION_SOURCE to a couple of serialization source files, which allows the build to work and most of the tests to pass (there are still a few failures, but i have't looked at those yet).

Attachments (2)

serialization-mingw.patch (941 bytes ) - added by Richard Webb <richard.webb@…> 12 years ago.
buildlog.zip (2.5 KB ) - added by rwebb <richard.webb@…> 12 years ago.

Download all attachments as: .zip

Change History (9)

by Richard Webb <richard.webb@…>, 12 years ago

Attachment: serialization-mingw.patch added

comment:1 by anonymous, 12 years ago

Please look into this a little deeper.

The facility provided by

#define BOOST_SERIALIZATION_SOURCE

Should be provided by #include <boost/archive/detail/decl.hpp>

which should be included by another header.

Robert Ramey

comment:2 by rwebb <richard.webb@…>, 12 years ago

I suggested the above change because what appeared to be causing the failure was that the absence of BOOST_SERIALIZATION_SOURCE in shared_ptr_helper.cpp and basic_serializer_map.cpp was resulting in BOOST_SERIALIZATION_DECL being set to declspec(dllimport) when it needs to be declspec(dllexport) for the dll build to work.

There seems to be something else going on here as well though, as if i run the regression tests, i get loads of warnings along the lines of :

gcc.link ..\..\..\bin.v2\libs\serialization\test\test_derived_text_archive.test\gcc-mingw-4.5.0\debug\test_derived_text_archive.exe
Info: resolving vtable for boost::archive::archive_exception by linking to __imp___ZTVN5boost7archive17archive_exceptionE (auto-importc:/mingw450/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.)

It doesn't seem to cause any problems with the tests, but i don't know how auto import works so i can't say anything more about it.

comment:3 by Robert Ramey, 12 years ago

I've made a check in into the trunk to address this. Can you update and retest?

Robert Ramey

comment:4 by rwebb <richard.webb@…>, 12 years ago

It's still failing for me, though with a different error. I'm attaching a build log from a release dll version of the lib.

by rwebb <richard.webb@…>, 12 years ago

Attachment: buildlog.zip added

comment:5 by Robert Ramey, 12 years ago

Status: newassigned

I looked at this but still can't solve it. One thing I did notice was that the member function boost::serialization::extended_type_info::find(const char * key) is the only static function in the class. None of the other functions show up as unreferenced symbols. This could be a hint as to why the find function is the only one that might not be getting exported. I'm just leaving this note to remember this observation. I have no fix for now.

Robert Ramey

comment:6 by Bryce Adelstein Lelbach, 12 years ago

There seems to be three or so bugs on this issue (or related mingw issues with serialization). I'm going to take a look at it and see if I can I come up with a fix.

Other bugs are #4747, #4698 and #4699.

Bryce Lelbach

comment:7 by Robert Ramey, 12 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.