Opened 6 years ago

Last modified 5 years ago

#12450 new Bugs

oost/serialization/singleton.hpp:131: undefined reference to `boost::serialization::singleton_module::is_locked()'

Reported by: NASa Qian <cj.nasa@…> Owned by: Robert Ramey
Milestone: Boost 1.63.0 Component: serialization
Version: Boost 1.61.0 Severity: Regression
Keywords: singleton_module serialization wserialization Cc:

Description

When I am using the <boost/serialization/singleton.hpp> and compile my code, there is an error: oost/serialization/singleton.hpp:131: undefined reference to `boost::serialization::singleton_module::is_locked()'

I find the body of member functions of singleton_module is removed since version 1.61.0. Since user use only hpp file to inlucde and compile, so please reset the code as the pervious version such as 1.60 and 1.59

Change History (16)

comment:1 by anonymous, 6 years ago

Same here, unfortunately.

Applies to 1.61.0 but also to 1.62.0.

Compilers I tried: TDM/GCC v5.1.0 (32 and 64 bit) MinGW_64 GCC 6.2.0 (32 and 64 bit)

Both are installed using their Web-Installers with default installation option.

They all fail.

OS is Windows 10 64 bit.

comment:2 by anonymous, 6 years ago

Keywords: serialization wserialization added
Milestone: Boost 1.61.0Boost 1.63.0

...wserialization fails, too. Bute here, the error is:

\basic_text_wiprimitive.o:basic_text_wiprimitive.cpp: undefined reference to `vtable for boost::archive::codecvt_null<wchar_t>'

Its possible to fix the first error (serialization) with:

  • removing singleton.cpp from the list of file to be compiled in [boost]\libs\serialization\build\Jamfile.v2 and
  • (re-)adding the implementation of that file to [boost]\boost\serialization\serialization.hpp

...such as it was before.

comment:3 by cj.nasa@…, 6 years ago

I have work around my problem by linking the lib: libboost_serialization.so

comment:4 by Robert Ramey, 6 years ago

OK - I gather this is not an issue with the serialization as such but rather the singleton code which is contained in the library. I'll consider moving it back to the header.

But the real solution is to just link with the serialization library.

I'm guessing that codecvt_null is not necessarily related.

comment:5 by anonymous, 6 years ago

Great news, ramey. Can you tell please if this has been fixed in GIT? Is boost 1.63.0 really targeted? Because for me that is a serious blocker to update from 1.61.0 to something more recent...

comment:6 by spam1@…, 6 years ago

Just tried the beta 1 of 1.63 and it still fails on Windows 10 x64, MinGW 4.9.2 (from the Qt 5.6.1 package):

toolset=gcc cxxflags="--std=c++11" --build-type=complete link=shared threading=multi runtime-link=shared variant=debug,release --without-python --without-mpi --without-coroutine --without-signals --prefix=../i686-windows-mingw492 -q install
Performing configuration checks

    - 32-bit                   : yes (cached)
    - arm                      : no  (cached)
    - mips1                    : no  (cached)
    - power                    : no  (cached)
    - sparc                    : no  (cached)
    - x86                      : yes (cached)
    - symlinks supported       : no  (cached)
    - junctions supported      : yes (cached)
    - hardlinks supported      : yes (cached)
    - C++11 mutex              : yes (cached)
    - Boost.Config Feature Check: cxx11_auto_declarations : yes (cached)
    - Boost.Config Feature Check: cxx11_constexpr : yes (cached)
    - Boost.Config Feature Check: cxx11_defaulted_functions : yes (cached)
    - Boost.Config Feature Check: cxx11_final : yes (cached)
    - Boost.Config Feature Check: cxx11_hdr_tuple : yes (cached)
    - Boost.Config Feature Check: cxx11_lambdas : yes (cached)
    - Boost.Config Feature Check: cxx11_noexcept : yes (cached)
    - Boost.Config Feature Check: cxx11_nullptr : yes (cached)
    - Boost.Config Feature Check: cxx11_rvalue_references : yes (cached)
    - Boost.Config Feature Check: cxx11_template_aliases : yes (cached)
    - Boost.Config Feature Check: cxx11_thread_local : no  (cached)
    - Boost.Config Feature Check: cxx11_variadic_templates : yes (cached)
    - has_icu builds           : no  (cached)
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
    - zlib                     : yes (cached)
    - bzip2                    : no  (cached)
    - iconv (libc)             : no  (cached)
    - iconv (separate)         : yes (cached)
    - icu                      : no  (cached)
    - icu (lib64)              : no  (cached)
    - g++ -shared-* supported  : no  (cached)
    - native-atomic-int32-supported : yes (cached)
    - message-compiler         : no  (cached)
    - pthread-supports-robust-mutexes : no  (cached)
    - compiler-supports-visibility : yes (cached)
    - compiler-supports-ssse3  : yes (cached)
    - compiler-supports-avx2   : yes (cached)
    - gcc visibility           : yes (cached)
    - long double support      : yes (cached)
    - zlib                     : yes (cached)
    - bzip2                    : no  (cached)

Component configuration:

    - atomic                   : building
    - chrono                   : building
    - container                : building
    - context                  : building
    - coroutine                : not building
    - coroutine2               : building
    - date_time                : building
    - exception                : building
    - fiber                    : building
    - filesystem               : building
    - graph                    : building
    - graph_parallel           : building
    - iostreams                : building
    - locale                   : building
    - log                      : building
    - math                     : building
    - metaparse                : building
    - mpi                      : not building
    - program_options          : building
    - python                   : not building
    - random                   : building
    - regex                    : building
    - serialization            : building
    - signals                  : not building
    - system                   : building
    - test                     : building
    - thread                   : building
    - timer                    : building
    - type_erasure             : building
    - wave                     : building

...patience...
...patience...
...patience...
...patience...
...patience...
...found 37107 targets...
...updating 739 targets...
gcc.link.dll bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\libboost_serialization-mgw49-mt-d-1_63.dll.a
bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\binary_iarchive.o: In function `ZN5boost13serialization9singletonINS_7archive6detail12extra_detail3mapINS2_15binary_iarchiveEEEE20get_mutable_instanceEv':
D:\Projekte\library-boost\boost_1_63_0_b1\boost_1_63_0/./boost/serialization/singleton.hpp:131: undefined reference to `_imp___ZN5boost13serialization16singleton_module9is_lockedEv'
bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\binary_oarchive.o: In function `ZN5boost13serialization9singletonINS_7archive6detail12extra_detail3mapINS2_15binary_oarchiveEEEE20get_mutable_instanceEv':
D:\Projekte\library-boost\boost_1_63_0_b1\boost_1_63_0/./boost/serialization/singleton.hpp:131: undefined reference to `_imp___ZN5boost13serialization16singleton_module9is_lockedEv'
bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\polymorphic_iarchive.o: In function `ZN5boost13serialization9singletonINS_7archive6detail12extra_detail3mapINS2_20polymorphic_iarchiveEEEE20get_mutable_instanceEv':
D:\Projekte\library-boost\boost_1_63_0_b1\boost_1_63_0/./boost/serialization/singleton.hpp:131: undefined reference to `_imp___ZN5boost13serialization16singleton_module9is_lockedEv'
bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\polymorphic_oarchive.o: In function `ZN5boost13serialization9singletonINS_7archive6detail12extra_detail3mapINS2_20polymorphic_oarchiveEEEE20get_mutable_instanceEv':
D:\Projekte\library-boost\boost_1_63_0_b1\boost_1_63_0/./boost/serialization/singleton.hpp:131: undefined reference to `_imp___ZN5boost13serialization16singleton_module9is_lockedEv'
bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\text_iarchive.o: In function `ZN5boost13serialization9singletonINS_7archive6detail12extra_detail3mapINS2_13text_iarchiveEEEE20get_mutable_instanceEv':
D:\Projekte\library-boost\boost_1_63_0_b1\boost_1_63_0/./boost/serialization/singleton.hpp:131: undefined reference to `_imp___ZN5boost13serialization16singleton_module9is_lockedEv'
bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\text_oarchive.o:D:\Projekte\library-boost\boost_1_63_0_b1\boost_1_63_0/./boost/serialization/singleton.hpp:131: more undefined references to `_imp___ZN5boost13serialization16singleton_module9is_lockedEv' follow
collect2.exe: error: ld returned 1 exit status

    "g++"   "-Wl,--out-implib,bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\libboost_serialization-mgw49-mt-d-1_63.dll.a" -o "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\libboost_serialization-mgw49-mt-d-1_63.dll"  -shared -Wl,--start-group "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_archive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_iarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_iserializer.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_oarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_oserializer.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_pointer_iserializer.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_pointer_oserializer.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_serializer_map.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_text_iprimitive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_text_oprimitive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\basic_xml_archive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\binary_iarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\binary_oarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\extended_type_info.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\extended_type_info_typeid.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\extended_type_info_no_rtti.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\polymorphic_iarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\polymorphic_oarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\stl_port.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\text_iarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\text_oarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\void_cast.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\archive_exception.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\xml_grammar.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\xml_iarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\xml_oarchive.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\xml_archive_exception.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\codecvt_null.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\utf8_codecvt_facet.o" "bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\singleton.o"  -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g -march=i686 -mthreads -m32

...failed gcc.link.dll bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\libboost_serialization-mgw49-mt-d-1_63.dll.a bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\libboost_serialization-mgw49-mt-d-1_63.dll...
...removing bin.v2\libs\serialization\build\gcc-mingw-4.9.2\debug\threading-multi\libboost_serialization-mgw49-mt-d-1_63.dll.a
...failed updating 1 target...}}}

comment:7 by anonymous, 6 years ago

The debug version of boost 1.6.3 still fails with an error on GCC 5.1.0. :-/

in reply to:  7 comment:8 by anonymous, 6 years ago

Replying to anonymous:

The debug version of boost 1.6.3 still fails with an error on GCC 5.1.0. :-/

Sorry. I got this in to the develop branch but had problems getting other changes to pass all the test. By the time I got this done, the master was closed to merges. Finally 1.63 was released and merge was open again and I've merged develop into master. So there shouldn't be any pending changes left. That is, any changes I made should show up in 1.64. On the other hand, this took a long time and I now forget exactly which changes might have been. To verify this, one could update the master on his local tree and run your test again.

comment:9 by anonymous, 5 years ago

I still got the same error in building 1_64_0 after I installed the binary for Windows of the same version and then using MinGW GCC 7.1.0 to compile that source.

comment:10 by anonymous, 5 years ago

Here is the log (no problem for the static library): gcc.link.dll bin.v2\libs\serialization\build\gcc-mingw-7.1.0\release\threading-multi\libboost_wserialization-mgw71-mt-1_64.dll.a bin.v2\libs\serialization\build\gcc-mingw-7.1.0\release\threading-multi\basic_text_wiprimitive.o:basic_text_wiprimitive.cpp:(.rdata$.refptr._ZTVN5boost7archive12codecvt_nullIwEE[.refptr._ZTVN5boost7archive12codecvt_nullIwEE]+0x0): undefined reference to `vtable for boost::archive::codecvt_null<wchar_t>' collect2.exe: error: ld returned 1 exit status

comment:11 by anonymous, 5 years ago

...the same also applies for MinGW 5.1.0:

gcc.link.dll ..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\libboost_serialization-mgw51-d-1_64.dll.a ..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\binary_iarchive.o: In function `boost::serialization::singleton_module::is_locked()': D:\boost_1_64\libs\serialization\build/../../../boost/serialization/singleton.hpp:99: undefined reference to `impZN5boost13serialization16singleton_module8get_lockEv' collect2.exe: error: ld returned 1 exit status

"g++" "-Wl,--out-implib,..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\libboost_serialization-mgw51-d-1_64.dll.a" -o "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\libboost_serialization-mgw51-d-1_64.dll" -shared -Wl,--start-group "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_archive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_iarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_iserializer.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_oarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_oserializer.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_pointer_iserializer.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_pointer_oserializer.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_serializer_map.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_text_iprimitive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_text_oprimitive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\basic_xml_archive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\binary_iarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\binary_oarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\extended_type_info.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\extended_type_info_typeid.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\extended_type_info_no_rtti.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\polymorphic_iarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\polymorphic_oarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\stl_port.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\text_iarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\text_oarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\void_cast.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\archive_exception.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\xml_grammar.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\xml_iarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\xml_oarchive.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\xml_archive_exception.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\codecvt_null.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\utf8_codecvt_facet.o" "..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\singleton.o" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -g -m64

...failed gcc.link.dll ..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\libboost_serialization-mgw51-d-1_64.dll.a ..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\libboost_serialization-mgw51-d-1_64.dll... ...removing ..\..\..\bin.v2\libs\serialization\build\gcc-mingw-5.1.0\debug\libboost_serialization-mgw51-d-1_64.dll.a

...any chance that this gets sorted out? The compilation with major version on MinGW is broken since many versions now... :-(

comment:12 by Robert Ramey, 5 years ago

I've been looking for this on and off for months now. I'm pretty sure it's related to visibility attributes in conjunction with possible the definition of wchar on the mingw compiler.

comment:13 by anonymous, 5 years ago

I am still getting the error when building 1_65_0 using either MiunGW 5.1.0 or MinGW GCC 7.1.0 to compile the library. No matter what falvour (32 or 64 bit) I can't build libserialization and all dependend libs therefore. :-(

A heads-up statement would be very nice, maybe there is a solution presnt I fail to find?

comment:14 by anonymous, 5 years ago

If its visibility, what changes did make it stop working? Why did the visibility change at all? I would prefer a working library instead visibility voodoo...*quickly_running_away* ;-)

comment:15 by James E. King, III, 5 years ago

Interestingly, #12205 also has a mingw issue with wchar_t. I wonder if they are related. I was trying to add appveyor CI build checks to the uuid library which depends on serialization, and I cannot build serialization in develop with any compiler: msvc-12, msvc-14, msvc-14.1, cygwin, mingw, mingw with gcc 6.3. I can build serialization in the master branch on all but mingw due to #12205.

Here's an appveyor build where it gets the latest boost master for everything except the incoming PR, and tries to build uuid, as you can see everything but mingw builds:

https://ci.appveyor.com/project/jeking3/uuid/build/1.0.5-issue-27

Here's the same job for a pull request against develop, which pulls in the develop branch for everything except the incoming PR, and all builds failed (note I disabled mingw builds because of the previous issue):

https://ci.appveyor.com/project/jeking3/uuid/build/1.0.6-develop

So to summarize, I can't build anything against develop because of this, but if I use master I can build some things. This is more sever than just a problem as it breaks a platform, so I am going to raise the priority.

comment:16 by James E. King, III, 5 years ago

Severity: ProblemRegression
Note: See TracTickets for help on using tickets.