Bug #3834
Updated by Junxiao Shi about 8 years ago
https://github.com/named-data/ndn-cxx/blob/master/src/util/logger.hpp#L118-L123 In [util/logger.hpp](https://github.com/named-data/ndn-cxx/tree/1fe7ce585057794a72847134a69c8d77a0a599c1/src/util/logger.hpp#L118-L123), the above link, we have a workaround for [Boost Ticket 11549](https://svn.boost.org/trac/boost/ticket/11549). a boost bug. But this workaround methods somehow failed to work on OSX 10.10 with boost version 1.59.0. 105900. ``` [104/305] Compiling src/util/logger.cpp [159/305] Compiling src/mgmt/dispatcher.cpp ../tests/unit-tests/util/log-module2.cpp:33:3: error: invalid operands to binary expression ('basic_record_ostream<char_type>' and '::ndn::util::LoggerTimestamp') NDN_LOG_TRACE("trace" << 2); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:137:35: note: expanded from macro 'NDN_LOG_TRACE' #define NDN_LOG_TRACE(expression) NDN_LOG(TRACE, TRACE, expression) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:128:40: note: expanded from macro 'NDN_LOG' NDN_BOOST_LOG(getNdnCxxLogger()) << ::ndn::util::LoggerTimestamp{} \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/local/include/boost/log/utility/formatting_ostream.hpp:377:31: note: candidate function not viable: no known conversion from '::ndn::util::LoggerTimestamp' to 'ios_base_manip' (aka 'std::ios_base &(*)(std::ios_base &)') for 1st argument basic_formatting_ostream& operator<< (ios_base_manip manip) ^ /opt/local/include/boost/log/utility/formatting_ostream.hpp:382:31: note: candidate function not viable: no known conversion from '::ndn::util::LoggerTimestamp' to 'basic_ios_manip' (aka 'std::basic_ios<char_type, traits_type> &(*)(std::basic_ios<char_type, traits_type> &)') for 1st argument basic_formatting_ostream& operator<< (basic_ios_manip manip) ^ /opt/local/include/boost/log/utility/formatting_ostream.hpp:387:31: note: candidate function not viable: no known conversion from '::ndn::util::LoggerTimestamp' to 'stream_manip' (aka 'ostream_type &(*)(ostream_type &)') for 1st argument basic_formatting_ostream& operator<< (stream_manip manip) ... /opt/local/include/boost/log/utility/formatting_ostream.hpp:802:1: note: candidate template ignored: substitution failure [with StreamT = boost::log::v2_mt_posix::basic_record_ostream<char> &, T = ndn::util::LoggerTimestamp]: no type named 'type' in 'boost::log::v2_mt_posix::aux::enable_if_formatting_ostream<boost::log::v2_mt_posix::basic_record_ostream<char> &, boost::log::v2_mt_posix::basic_record_ostream<char> &>' operator<< (StreamT&& strm, T const& value) ^ ../tests/unit-tests/util/log-module2.cpp:34:3: error: invalid operands to binary expression ('basic_record_ostream<char_type>' and '::ndn::util::LoggerTimestamp') NDN_LOG_DEBUG("debug" << 2); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:142:35: note: expanded from macro 'NDN_LOG_DEBUG' #define NDN_LOG_DEBUG(expression) NDN_LOG(DEBUG, DEBUG, expression) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:128:40: note: expanded from macro 'NDN_LOG' NDN_BOOST_LOG(getNdnCxxLogger()) << ::ndn::util::LoggerTimestamp{} \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/local/include/boost/log/utility/formatting_ostream.hpp:377:31: note: candidate function not viable: no known conversion from '::ndn::util::LoggerTimestamp' to 'ios_base_manip' (aka 'std::ios_base &(*)(std::ios_base &)') for 1st argument basic_formatting_ostream& operator<< (ios_base_manip manip) ... ../tests/unit-tests/util/log-module2.cpp:35:3: error: invalid operands to binary expression ('basic_record_ostream<char_type>' and '::ndn::util::LoggerTimestamp') NDN_LOG_INFO("info" << 2); ^~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:147:34: note: expanded from macro 'NDN_LOG_INFO' #define NDN_LOG_INFO(expression) NDN_LOG(INFO, INFO, expression) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:128:40: note: expanded from macro 'NDN_LOG' NDN_BOOST_LOG(getNdnCxxLogger()) << ::ndn::util::LoggerTimestamp{} \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... ../tests/unit-tests/util/log-module1.cpp:38:3: error: invalid operands to binary expression ('basic_record_ostream<char_type>' and '::ndn::util::LoggerTimestamp') NDN_LOG_FATAL("fatal" << 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:162:35: note: expanded from macro 'NDN_LOG_FATAL' #define NDN_LOG_FATAL(expression) NDN_LOG(FATAL, FATAL, expression) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/weiweiliu/development/ndn-cxx/src/util/logger.hpp:128:40: note: expanded from macro 'NDN_LOG' NDN_BOOST_LOG(getNdnCxxLogger()) << ::ndn::util::LoggerTimestamp{} \ ... 6 errors generated. Waf: Leaving directory `/Users/weiweiliu/development/ndn-cxx/build' Build failed -> task in 'unit-test-objects' failed (exit status 1): {task 4501325392: cxx log-module2.cpp -> log-module2.cpp.3.o} ['/usr/bin/clang++', '-O2', '-g', '-pedantic', '-Wall', '-Wextra', '-Wno-unused-parameter', '-fcolor-diagnostics', '-Wno-unused-local-typedef', '-std=c++11', '-stdlib=libc++', '', '-I/Users/weiweiliu/development/ndn-cxx/build/tests', '-I/Users/weiweiliu/development/ndn-cxx/tests', '-I/Users/weiweiliu/development/ndn-cxx/build/src', '-I/Users/weiweiliu/development/ndn-cxx/src', '-I/opt/local/include', '-DNDEBUG', '-DUNIT_TEST_CONFIG_PATH="build/tmp-files/"', '-DBOOST_LOG_DYN_LINK', '-DCRYPTOPP_DISABLE_ASM', '../tests/unit-tests/util/log-module2.cpp', '-c', '-o', '/Users/weiweiliu/development/ndn-cxx/build/tests/unit-tests/util/log-module2.cpp.3.o'] -> task in 'unit-test-objects' failed (exit status 1): {task 4501325264: cxx log-module1.cpp -> log-module1.cpp.3.o} ['/usr/bin/clang++', '-O2', '-g', '-pedantic', '-Wall', '-Wextra', '-Wno-unused-parameter', '-fcolor-diagnostics', '-Wno-unused-local-typedef', '-std=c++11', '-stdlib=libc++', '', '-I/Users/weiweiliu/development/ndn-cxx/build/tests', '-I/Users/weiweiliu/development/ndn-cxx/tests', '-I/Users/weiweiliu/development/ndn-cxx/build/src', '-I/Users/weiweiliu/development/ndn-cxx/src', '-I/opt/local/include', '-DNDEBUG', '-DUNIT_TEST_CONFIG_PATH="build/tmp-files/"', '-DBOOST_LOG_DYN_LINK', '-DCRYPTOPP_DISABLE_ASM', '../tests/unit-tests/util/log-module1.cpp', '-c', '-o', '/Users/weiweiliu/development/ndn-cxx/build/tests/unit-tests/util/log-module1.cpp.3.o'] ```