From 0417338bbbe28377a5c20e1b0d38dc802ea06b2b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Oct 2019 15:04:30 +0200 Subject: Only enable backtrace support on Linux if using glibc Other libc implementations, for example musl, don't support this out of the box. --- libbutl/backtrace.cxx | 7 +++++-- libbutl/backtrace.mxx | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'libbutl') diff --git a/libbutl/backtrace.cxx b/libbutl/backtrace.cxx index 7a8d615..a66faa2 100644 --- a/libbutl/backtrace.cxx +++ b/libbutl/backtrace.cxx @@ -12,14 +12,17 @@ // With glibc linking with -rdynamic gives (non-static) function names. // FreeBSD requires explicitly linking -lexecinfo. // +// Note that some libc implementation on Linux (most notably, musl), don't +// support this, at least not out of the box. +// #ifndef BUILD2_BOOTSTRAP -# if defined(__linux__) || \ +# if defined(__GLIBC__) || \ defined(__APPLE__) || \ defined(__FreeBSD__) # define LIBBUTL_BACKTRACE # endif #else -# if defined(__linux__) || \ +# if defined(__GLIBC__) || \ defined(__APPLE__) # define LIBBUTL_BACKTRACE # endif diff --git a/libbutl/backtrace.mxx b/libbutl/backtrace.mxx index 25d0dcd..38b9ce2 100644 --- a/libbutl/backtrace.mxx +++ b/libbutl/backtrace.mxx @@ -31,10 +31,10 @@ LIBBUTL_MODEXPORT namespace butl // with the binary name, address in that binary, and, if available, the // function name for each stack frame. // - // Currently this functionality is only available on Linux, FreeBSD, and Mac - // OS. On the first two platforms the address can be mapped to the function - // name and, if built with debug info, to source location using the - // addr2line(1) utility: + // Currently this functionality is only available on Linux (with glibc), + // FreeBSD, and Mac OS. On the first two platforms the address can be mapped + // to the function name and, if built with debug info, to source location + // using the addr2line(1) utility: // // $ addr2line -f -C -e // -- cgit v1.1