[Nfd-dev] NFD compile error "NFD_LOG_DEBUG"

Thompson, Jeff jefft0 at remap.UCLA.edu
Mon Jul 18 09:43:25 PDT 2016


Hi Davide,

Good hint. logger.hpp has the following line.
https://github.com/named-data/NFD/blob/master/core/logger.hpp#L149

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

When I changed it to the following I was able to compile.

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

Thanks,
- Jeff T

On 2016/7/18, 9:23:04, "Davide Pesavento" <davide.pesavento at lip6.fr<mailto:davide.pesavento at lip6.fr>> wrote:

Hi Jeff,

If I remember correctly, we had the same problem in ndn-cxx during the
2nd NDN hackathon.

Basically the type returned by BOOST_LOG() doesn't like the overload
of operator<< for LoggerTimestamp. The reasons for this behavior were
not further investigated due to lack of time during the hackathon. The
workaround we implemented was to feed an empty string to the boost
logger before everything else[1].

I remember not everyone on the team was able to reproduce, so I
suppose the issue is very much dependent on the compiler and/or boost
version used. I don't know why we didn't adopt the same workaround
when NFD was switched over to Boost.Log... probably because we
couldn't reproduce anymore.

Junxiao or Spyros might remember more details.

[1] https://github.com/2nd-ndn-hackathon/ndn-cxx-logging/blob/master/src/util/logger.hpp#L107

Thanks,
Davide

On Mon, Jul 18, 2016 at 5:44 PM, Thompson, Jeff <jefft0 at remap.ucla.edu<mailto:jefft0 at remap.ucla.edu>> wrote:
Hello NFD developers,

On a fresh OS X 10.11 virtual machine, 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 was able to compile and install ndn-cxx. But when I compile NFD I get many
errors starting with those below. Is there an extra configuration step
relating to the logger?

Thanks,
- Jeff T

../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)

                               ^

/opt/local/include/boost/log/utility/formatting_ostream.hpp:382:31: note:
candidate function not viable: no known conversion from
'::nfd::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)



_______________________________________________
Nfd-dev mailing list
Nfd-dev at lists.cs.ucla.edu<mailto:Nfd-dev at lists.cs.ucla.edu>
http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20160718/05b61e84/attachment.html>


More information about the Nfd-dev mailing list