aws/aws-iot-fleetwise-edge

ConsoleLogger not working on all architectures

magDSA opened this issue · 1 comments

Hello,

I cross compiled the AWS IoT FleetWise edge agent to get it running on my device.
Unfortunately the agent always breaks, because of an issue in the ConsoleLogger class:

std::printf( "[Thread : %lu] [%s] [%s] [%s]: [%s] ",
currentThreadId(),
timeAsString().c_str(),
levelToString( level ).c_str(),
function.c_str(),
logEntry.c_str() );

This is the compiler warning that it shows during compilation:

/aws-iot-fleetwise-edge/src/platform/linux/logmanagement/src/ConsoleLogger.cpp:76:35: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
   76 |         std::printf( "[Thread : %lu] [%s] [%s] [%s]: [%s] ",
      |                                 ~~^
      |                                   |
      |                                   long unsigned int
      |                                 %llu
   77 |                      currentThreadId(),
      |                      ~~~~~~~~~~~~~~~~~
      |                                     |
      |                                     uint64_t {aka long long unsigned int}

I was able to get it running by replacing %lu in line 76 with %llu.
Would it be possible to adapt the ConsoleLogger class so that it works independent of the interpretation of type uint64_t?

The target platform is a Debian/Yocto and I cross compile on Ubuntu 18.04.5 LTS using GCC 9.3.0

Thanks for your bug report. This issue affects versions <= v0.1.2
This will be fixed in v0.1.3