bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.78k stars 480 forks source link

Improve portability to non-glibc Linux systems #144

Closed johnsalmon closed 5 years ago

johnsalmon commented 5 years ago

Linux is not synonymous with glibc. Alpine linux (among others) uses libmusl as the standard C library. Alpine/libmusl doesn't have backtrace, dladdr1, execinfo.h or error.h. It does have libunwind and program_invocation_name and libdwarf and libelf are available as packages.

This patch makes backward-cpp work on Alpine linux (and hopefully others that rely on libmusl).

This patch makes dladdr1 dependent on the GLIBC pp-symbol (rather than ANDROID).

It uses __has_include (protected by a defined()) rather than APPLE to decide whether to include in _test_main.cpp.