[serialization] linker error with static build of serialization on Mingw gcc 4.4.0

Hi fellow users, I build boost 1.43 on windows, using mingw with gcc 4.4.0: Using built-in specs. Target: mingw32 Configured with: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,java,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enable-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root --with-mpfr=/mingw/src/mpfr/root --build=mingw32 Thread model: win32 gcc version 4.4.0 (GCC) with the following command: bjam.exe install -q --layout=system --with-system --with-thread --with-python --with-serialization toolset=gcc variant=release link=static threading=multi runtime-link=static When I now build a shared library, itself linking statically the libboost_serialization.a, I get the following linker error: Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_iarchiveEEE12get_instanceEv: symbol not found Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_iarchiveEEE12is_destroyedEv: symbol not found Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_iarchiveEEE18get_const_instanceEv: symbol not found Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_iarchiveEEE20get_mutable_instanceEv: symbol not found Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_oarchiveEEE12get_instanceEv: symbol not found Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_oarchiveEEE12is_destroyedEv: symbol not found Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_oarchiveEEE18get_const_instanceEv: symbol not found Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_oarchiveEEE20get_mutable_instanceEv: symbol not found collect2: ld returned 1 exit status Am I missing some build step? Regards, Philipp

When I now build a shared library, itself linking statically the
Philipp Münzel
following linker error:
Cannot export _ZN5boost13serialization9singletonINS_7archive6detail12_GLOBAL__N_ 13mapI24portable_binary_iarchiveEEE12get_instanceEv: symbol not found ... collect2: ld returned 1 exit status
I apologize for not being precise on what I compile. Here what I did: -I upgraded to boost 1.44 on both Linux and Windows. -I build static version of boost-serialization as mentioned above -I copied from libs/serialization/example the files portable_binary_archive.hpp portable_binary_iarchive.hpp portable_binary_oarchive.hpp portable_binary_iarchive.cpp portable_binary_oarchive.cpp into my own project and added the *.cpps to my Makefile. The project builds a dynamic library which itself links the static version of libboost_serialization.a Everything works fine (builds, runs, output is sane) on Linux, but trying to build the project on Windows produces the aforementioned linker error. Any insight is greatly appreciated. Philipp

Philipp Münzel
Everything works fine (builds, runs, output is sane) on Linux, but trying to build the project on Windows produces the aforementioned linker error.
Any insight is greatly appreciated.
Philipp
And I have again to reply to myself: It looks like a known bug: Searching for "boost cannot export symbol not found" google returned me https://svn.boost.org/trac/boost/ticket/4670 and https://svn.boost.org/trac/boost/ticket/4698 But what is going on with this website? If i click these links, I get a blank page. I can view them via google ("View Cached"), but I can't access the attached patch. Philipp

Philipp Münzel
and
I can view them via google ("View Cached"), but I can't access
the attached patch.
I got a highly appreciated reply off-list with the following
patches that should enable a succefull use with MinGw gcc4.4:
Index: serialization/build/Jamfile.v2
=================================================================
--- serialization/build/Jamfile.v2 (revision 65950)
+++ serialization/build/Jamfile.v2 (working copy)
@@ -10,6 +10,7 @@
: source-location ../src
: requirements
<conditional>@include-spirit
+ <define>BOOST_SERIALIZATION_SOURCE=1
;
SPIRIT_ROOT = [ modules.peek : SPIRIT_ROOT ] ;
Index: boost/archive/impl/archive_serializer_map.ipp
=================================================================
--- boost/archive/impl/archive_serializer_map.ipp (revision 65950)
+++ boost/archive/impl/archive_serializer_map.ipp (working copy)
@@ -26,7 +26,7 @@
# pragma warning(disable : 4511 4512)
#endif
-namespace { // anon
+namespace extra_detail { // anon
template<class Archive>
class map : public basic_serializer_map
{};
@@ -40,7 +40,7 @@
BOOST_ARCHIVE_OR_WARCHIVE_DECL(bool)
archive_serializer_map<Archive>::insert
(const basic_serializer * bs){
return boost::serialization::singleton<
- map<Archive>
+ boost::archive::detail::extra_detail::map<Archive>
>::get_mutable_instance().insert(bs);
}
@@ -48,11 +48,11 @@
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
archive_serializer_map<Archive>::erase
(const basic_serializer * bs){
if(boost::serialization::singleton<
- map<Archive>
+ boost::archive::detail::extra_detail::map<Archive>
>::is_destroyed())
return;
boost::serialization::singleton<
- map<Archive>
+ boost::archive::detail::extra_detail::map<Archive>
>::get_mutable_instance().erase(bs);
}
@@ -62,7 +62,7 @@
const boost::serialization::extended_type_info & eti
) {
return boost::serialization::singleton<
- map<Archive>
+ boost::archive::detail::extra_detail::map<Archive>
>::get_const_instance().find(eti);
}
Index: libs/thread/src/win32/thread.cpp
==================================================================
--- libs/thread/src/win32/thread.cpp (revision 65950)
+++ libs/thread/src/win32/thread.cpp (working copy)
@@ -586,8 +586,11 @@
else
{
detail::thread_data_base* const
current_thread_data(get_or_make_current_thread_data());
- tss_data_node* const
new_node=heap_new

At Sat, 16 Oct 2010 19:30:51 +0000 (UTC), Philipp Münzel wrote:
Philipp Münzel
writes: Everything works fine (builds, runs, output is sane) on Linux, but trying to build the project on Windows produces the aforementioned linker error.
Any insight is greatly appreciated.
Philipp
And I have again to reply to myself: It looks like a known bug: Searching for "boost cannot export symbol not found" google returned me https://svn.boost.org/trac/boost/ticket/4670 and https://svn.boost.org/trac/boost/ticket/4698
It's back up. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

David Abrahams
And I have again to reply to myself: It looks like a known bug: Searching for "boost cannot export symbol not found" google returned me https://svn.boost.org/trac/boost/ticket/4670 and https://svn.boost.org/trac/boost/ticket/4698
It's back up.
Thanks for the heads-up. However, I have alrady installed the patches (see previous mail) and I'm still unable to use boost.serialization. Without the patches, I get the linker error. With the patches, boost doesn't even compile
gcc.compile.c++ bin.v2\libs\serialization\build\gcc-mingw-4.4.0\ release\link-static\runtime-link-static\threading-multi\ polymorphic_iarchive.o
In file included from ./boost/archive/detail/iserializer.hpp:81, from ./boost/archive/polymorphic_iarchive.hpp:33, from libs\serialization\src\polymorphic_iarchive.cpp:19: ./boost/serialization/collection_size_type.hpp:59: error: expected constructor, destructor, or type conversion before '(' token
I got so fed up, I dug my old gcc 3.4.5-powered backup of MinGW running to try a build with it. Result: gcc.compile.c++ bin.v2\libs\serialization\build\gcc-mingw-3.4.2\ release\link-static\threading-multi\basic_text_wiprimitive.o libs\serialization\src\basic_text_wiprimitive.cpp:14:2: #error "wide char i/o not supported on this platform" "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthreads -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -c -o "bin.v2\libs\serialization\build\gcc-mingw-3.4.2\release\ link-static\threading-multi\basic_text_wiprimitive.o" "libs\serialization\src\basic_text_wiprimitive.cpp" I also googled this one and found an open bug from boost 1.35 (!!!!) Bottom line: boost-serialization is unusable with both mingw-gcc-3.4.5 and mingw-gcc-4.4.0 Folks, this is utterly ridiculous. This is supposed to be the most portable and most standards compliant library in the WORLD and it doesn't even COMPILE on windows?! Philipp
participants (2)
-
David Abrahams
-
Philipp Münzel