Closed Michel2904 closed 7 years ago
on linux with gcc - the NanoLogLine comes to 256 bytes - hence the size of padding [256 - sizeof(std::atomic_flag) - sizeof(char) - sizeof(NanoLogLine)] - comes to negative number. No idea what its for - and why thats the case.
Hey guys,
Thanks for raising this. Its a bug that gets seen only on 64bit os. Previously i had 2 members in nanologline as unint32_t. I believe one the contributors changed it to size_t but forgot to change the type in the padding. On 32 bit size_t is the same as uint32_t so I never noticed this issue. 64 bit size_t is 2 times that of uint32_t so compilation fails.
Ill fix this soon.
Thanks for raising.
Karthik Iyengar
Fixed now.
I can confirm this is fixed now!
Thanks,
Michel
From: "Iyengar111" notifications@github.com To: "Iyengar111/NanoLog" NanoLog@noreply.github.com Cc: "Michel Polder" michel.polder@quality-it.com, "Author" author@noreply.github.com Sent: Wednesday, March 8, 2017 8:35:59 AM Subject: Re: [Iyengar111/NanoLog] gcc 4.8 build (#17)
Hey guys,
Thanks for raising this. Its a bug that gets seen only on 64bit os. Previously i had 2 members in nanologline as unint32_t. I believe one the contributors changed it to size_t but forgot to change the type in the padding. On 32 bit size_t is the same as uint32_t so I never noticed this issue. 64 bit size_t is 2 times that of uint32_t so compilation fails.
Ill fix this soon.
Thanks for raising.
Karthik Iyengar
— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/Iyengar111/NanoLog/issues/17#issuecomment-285056999 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AV_VqIod6EWQPg4uhYK-zNOY5p3an5XOks5rjrzPgaJpZM4MOX9h | mute the thread ] .
Hi Karthik Iyengar
the link's Usage shows to write to a file. How to write to stdout/stderr? If I want to log a thread ID for each log line, how to do it?
Hi Karthik Iyengar,
Also seems nanolog is not actively maintained?
I'm trying to build NanoLog using gcc 4.8 on CentOS 7.3 64bit and it fails. I receive 2 errors:
NanoLog.cpp:357:86: error: size of array ‘padding’ is too large char padding[256 - sizeof(std::atomic_flag) - sizeof(char) - sizeof(NanoLogLine)]; ^ NanoLog.cpp: In constructor ‘nanolog::RingBuffer::RingBuffer(size_t)’: NanoLog.cpp:371:6: error: static assertion failed: Unexpected size != 256 static_assert(sizeof(Item) == 256, "Unexpected size != 256");
The sizeof(NanoLogLine) is 256 so that seems to be the issue. Do I need a newer gcc to build this?