Bug #3982
Updated by Alex Afanasyev almost 6 years ago
Snippet to reproduce: ``` #include <ndn-cxx/util/logger.hpp> NDN_LOG_INIT(MyLogModule); int main() { NDN_LOG_FATAL("my-fatal"); } ``` Expected: code compiles with `g++ -o x -std=c++14 -std=c++11 x.cpp $(pkg-config --cflags --libs libndn-cxx)` Actual: ``` /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::record::reset()': x.cpp:(.text._ZN5boost3log12v2s_mt_posix6record5resetEv[_ZN5boost3log12v2s_mt_posix6record5resetEv]+0x23): undefined reference to `boost::log::v2s_mt_posix::record_view::public_data::destroy(boost::log::v2s_mt_posix::record_view::public_data const*)' /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::logger_mt, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::~basic_logger()': x.cpp:(.text._ZN5boost3log12v2s_mt_posix7sources12basic_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEEED2Ev[_ZN5boost3log12v2s_mt_posix7sources12basic_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEEED5Ev]+0x18): undefined reference to `boost::log::v2s_mt_posix::attribute_set::~attribute_set()' /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::sources::basic_composite_logger<char, boost::log::v2s_mt_posix::sources::logger_mt, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex>, boost::log::v2s_mt_posix::sources::features<> >::open_record()': x.cpp:(.text._ZN5boost3log12v2s_mt_posix7sources22basic_composite_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEENS2_8featuresIIEEEE11open_recordEv[_ZN5boost3log12v2s_mt_posix7sources22basic_composite_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEENS2_8featuresIIEEEE11open_recordEv]+0x29): undefined reference to `boost::log::v2s_mt_posix::core::get_logging_enabled() const' /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::aux::record_pump<ndn::util::Logger>::~record_pump()': x.cpp:(.text._ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEED2Ev[_ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEED5Ev]+0x3c): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()' /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::record boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::logger_mt, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::open_record_unlocked<boost::parameter::aux::empty_arg_list>(boost::parameter::aux::empty_arg_list const&)': x.cpp:(.text._ZN5boost3log12v2s_mt_posix7sources12basic_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEEE20open_record_unlockedINS_9parameter3aux14empty_arg_listEEENS1_6recordERKT_[_ZN5boost3log12v2s_mt_posix7sources12basic_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEEE20open_record_unlockedINS_9parameter3aux14empty_arg_listEEENS1_6recordERKT_]+0x3e): undefined reference to `boost::log::v2s_mt_posix::core::open_record(boost::log::v2s_mt_posix::attribute_set const&)' /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::aux::record_pump<ndn::util::Logger>::record_pump(ndn::util::Logger&, boost::log::v2s_mt_posix::record&)': x.cpp:(.text._ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEEC2ERS6_RNS1_6recordE[_ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEEC5ERS6_RNS1_6recordE]+0x2f): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)' x.cpp:(.text._ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEEC2ERS6_RNS1_6recordE[_ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEEC5ERS6_RNS1_6recordE]+0x3c): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()' /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::aux::record_pump<ndn::util::Logger>::auto_release::~auto_release()': x.cpp:(.text._ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEE12auto_releaseD2Ev[_ZN5boost3log12v2s_mt_posix3aux11record_pumpIN3ndn4util6LoggerEE12auto_releaseD5Ev]+0x17): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)' /tmp/ccZHMwXm.o: In function `boost::log::v2s_mt_posix::sources::basic_logger<char, boost::log::v2s_mt_posix::sources::logger_mt, boost::log::v2s_mt_posix::sources::multi_thread_model<boost::log::v2s_mt_posix::aux::light_rw_mutex> >::push_record_unlocked(boost::log::v2s_mt_posix::record&&)': x.cpp:(.text._ZN5boost3log12v2s_mt_posix7sources12basic_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEEE20push_record_unlockedEONS1_6recordE[_ZN5boost3log12v2s_mt_posix7sources12basic_loggerIcNS2_9logger_mtENS2_18multi_thread_modelINS1_3aux14light_rw_mutexEEEE20push_record_unlockedEONS1_6recordE]+0x47): undefined reference to `boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)' collect2: error: ld returned 1 exit status ``` `g++ -o x -std=c++11 x.cpp $(pkg-config --cflags --libs libndn-cxx) -DBOOST_LOG_DYN_LINK` works fine. `-DBOOST_LOG_DYN_LINK` argument should be added into pkg-config output.