Problem statically linking Boost 1.63
Hi All, I have asked it on Stackoverflow, but know one seems to know the answer who saw it. I post it here, too, because 1.55 (which works for me) is quite old and has problems in logging: writing logfiles stops whithin a day every time. So 1.63 would be important for me to try. Link to the Stackoverflow post: http://stackoverflow.com/questions/42978843/boost-inner-function-argument-mi... Thank you in advance. Best regards: Balazs PS: I copy the post here, but its formatting will break in plain text. I have a strange problem during linking Boost 1.63.0. I use the following cmake lines to configure Boost: add_compile_options(-std=c++14 -DBOOST_LOG_DYN_LINK)set(BOOST_ROOT "/usr/local/alk/boost_1_63_0/") SET(Boost_USE_STATIC_LIBS OFF) find_package(Boost 1.63 REQUIRED COMPONENTS log_setup log regex thread date_time filesystem system) Then the sources compile, and the linker tells me similar messages: CMakeFiles/dsmip.dir/main.cpp.o: In function `boost::log::v2_mt_posix::sources::aux::logger_singleton<dataLogger>::init_instance()': /home/balazs/munka/neovoltaic/aufgaben/dsmip/main.cpp:(.text._ZN5boost3log11v2_mt_posix7sources3aux16logger_singletonI10dataLoggerE13init_instanceEv[_ZN5boost3log11v2_mt_posix7sources3aux16logger_singletonI10dataLoggerE13init_instanceEv]+0x2d): undefined reference to `boost::log::v2_mt_posix::sources::aux::global_storage::get_or_init(std::type_info const&, boost::shared_ptrboost::log::v2_mt_posix::sources::aux::logger_holder_base (*)())' Here the following function is missing: *boost::log::v2_mt_posix::sources::aux::global_storage::get_or_init(std::type_info const&, boost::shared_ptr (*)())* Going into the freshly compiled Boost stage directory: balazs@balazs:/usr/local/alk/boost_1_63_0/stage/lib$ grep get_or_init *Binary file libboost_log.so matchesBinary file libboost_log.so.1.63.0 matches balazs@balazs:/usr/local/alk/boost_1_63_0/stage/lib$ strings libboost_log.so |grep get_or_init _ZN5boost3log11v2_mt_posix7sources3aux14global_storage11get_or_initENS_9typeindex14stl_type_indexEPFNS_10shared_ptrINS3_18logger_holder_baseEEEvE Demangling it yields: *boost::log::v2_mt_posix::sources::aux::global_storage::get_or_init(boost::typeindex::stl_type_index, boost::shared_ptr (*)())* which are not identical, the first function argument type differs. I used these commands to compile Boost: ./bootstrap.sh --with-toolset=clang./b2 --build-type=minimal --layout=system toolset=clang variant=release link=shared threading=multi runtime-link=shared stage How can this happen? Actually, this dynamically linked Boost is my second experiment. Originally I wanted to link it statically. Thank you in advance. Best regards: Balázs Bámer EDIT Now I have tried the Boost libraries I get with apt-get, and the situation is the same. However, I have found my old settings. They do work: add_compile_options(-std=c++14) SET(Boost_USE_STATIC_LIBS ON) find_package(Boost 1.55 REQUIRED COMPONENTS log_setup log thread date_time filesystem system) find_package(Threads REQUIRED)
The signature change of `get_or_init` was introduced in boost 1.59: http://www.boost.org/users/history/version_1_59_0.html https://github.com/boostorg/log/commit/f1337c6fbc5699b95eec5964bb187c9008b4d... And by a clean build of your project, no object file should have a reference to the `std::typeinfo` one. Try `make clean` your project, specifically, remove and rebuild `CMakeFiles/dsmip.dir/main.cpp.o` (which holds a reference to `get_or_init`), and see if it helps.
participants (2)
-
Balázs Bámer
-
d25fe0be@outlook.com