loguru icon indicating copy to clipboard operation
loguru copied to clipboard

Support for c standard libraries other than glibc

Open ghost opened this issue 7 years ago • 2 comments

When trying to compile cquery on Void Linux with musl libc I get the following error.

loguru.hpp:1391:11: fatal error: execinfo.h: No such file or directory
  #include <execinfo.h>  // for backtrace

execinfo.h is glibc specific and prevents compilation when using alternative standard libraries.

Is it possible to restructure loguru so that support doesn't depend on glibc?

ghost avatar Jun 30 '18 14:06 ghost

I guess you'd want to add something in this piece of code to either check for glibc or for musl:

https://github.com/emilk/loguru/blob/66f5895696c3adf43642fa032b0b5592858718c9/loguru.hpp#L1417:L1435

ideas welcome!

emilk avatar Sep 18 '18 16:09 emilk

Line 1423 in loguru.hpp should have || !defined(__GLIBC__).

Since execinfo.h is a glibc extension that is needed for stack traces, checking for glibc makes thte most sense. __GLIBC__ is defined to the major number of glibc version, __GLIBC_MINOR__ is minor number and __GNU_LIBRARY__ is the so-number. Probably testing for any of the three macros will suffice.

bstaletic avatar Oct 02 '18 10:10 bstaletic