Project

General

Profile

Actions

Bug #3674

closed

NFD_LOG compilation error

Added by Anonymous over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Core
Target version:
Start date:
07/18/2016
Due date:
% Done:

100%

Estimated time:

Description

I have OS X 10.11, Boost 1_59 and Apple LLVM version 7.0.2 (clang-700.1.81). I installed MacPorts and did:

sudo port install pkgconfig boost sqlite3 libcryptopp libpcap
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

I am able to compile and install ndn-cxx.
But when I compile NFD I get many errors starting with those below.

../daemon/table/cs.cpp:84:3: error: invalid operands to binary expression ('basic_record_ostream<char_type>' and '::nfd::LoggerTimestamp')
  NFD_LOG_DEBUG("insert " << data.getName());
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jefft0/work/NFD/core/logger.hpp:154:35: note: expanded from macro 'NFD_LOG_DEBUG'
#define NFD_LOG_DEBUG(expression) NFD_LOG(DEBUG, DEBUG,   expression)
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jefft0/work/NFD/core/logger.hpp:149:39: note: expanded from macro 'NFD_LOG'
      BOOST_LOG(g_logger.boostLogger) << NFD_LOG_LINE(msg, expression); \
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/boost/log/utility/formatting_ostream.hpp:377:31: note: candidate function not viable: no known conversion from '::nfd::LoggerTimestamp' to 'ios_base_manip' (aka 'std::ios_base &(*)(std::ios_base &)') for 1st argument
    basic_formatting_ostream& operator<< (ios_base_manip manip)
Actions #1

Updated by Junxiao Shi over 8 years ago

  • Subject changed from NFD compile error "NFD_LOG_DEBUG" to NFD_LOG_DEBUG compile errors
  • Description updated (diff)
  • Category set to Core
  • Target version set to v0.5

A workaround is to change a line in core/logger.hpp:

  BOOST_LOG(g_logger.boostLogger) << NFD_LOG_LINE(msg, expression); \

to:

  BOOST_LOG(g_logger.boostLogger) << "" << NFD_LOG_LINE(msg, expression); \

I tried Boost 1.60.0_2 (from HomeBrew) and there's no such error.

It's caused by Boost bug 11549.
The workaround is correct but it's only necessary with Boost 1.59.

Actions #2

Updated by Junxiao Shi over 8 years ago

  • Subject changed from NFD_LOG_DEBUG compile errors to NFD_LOG compilation error
  • Status changed from New to Code review
  • Assignee set to Junxiao Shi
  • % Done changed from 0 to 100
Actions #3

Updated by Junxiao Shi over 8 years ago

  • Status changed from Code review to Closed

The patch is effective for both affected users: JeffT, Muktadir.

Actions

Also available in: Atom PDF