1 From b7a166acaddc4c78afa2b653e25114d9114699f3 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Sat, 6 Aug 2016 11:24:50 +0200
4 Subject: [PATCH] Proper detection of cxxabi.h and execinfo.h
6 The current code in webrtc/base/checks.cc assumes that if __GLIBCXX__ is
7 defined and __UCLIBC__ is not defined, then both cxxabi.h and execinfo.h
10 Unfortunately, this is not correct with the musl C library:
12 - It defines __GLIBCXX__
13 - It does not define __UCLIBC__ (it's not uClibc after all!)
14 - But it also doesn't provide execinfo.h
16 Therefore, in order to make things work properly, we switch to proper
17 autoconf checks for cxxabi.h and execinfo.h, and only use the backtrace
18 functionality if both are provided.
20 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
23 webrtc/base/checks.cc | 4 ++--
24 2 files changed, 4 insertions(+), 2 deletions(-)
26 diff --git a/configure.ac b/configure.ac
27 index acbb3e2..ff4c752 100644
30 @@ -45,6 +45,8 @@ AC_SUBST(GNUSTL_CFLAGS)
31 # Borrowed from gst-plugins-bad
32 AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-])
34 +AC_CHECK_HEADERS([cxxabi.h execinfo.h])
36 # Based on gst-plugins-bad configure.ac and defines in
37 # <chromium source>/build/config/BUILDCONFIG.gn and
39 diff --git a/webrtc/base/checks.cc b/webrtc/base/checks.cc
40 index 49a31f2..05d23a6 100644
41 --- a/webrtc/base/checks.cc
42 +++ b/webrtc/base/checks.cc
47 -#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
48 +#if defined(HAVE_CXX_ABI_H) && defined(HAVE_EXECINFO_H)
52 @@ -55,7 +55,7 @@ void PrintError(const char* format, ...) {
53 // to get usable symbols on Linux. This is copied from V8. Chromium has a more
54 // advanced stace trace system; also more difficult to copy.
55 void DumpBacktrace() {
56 -#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
57 +#if defined(HAVE_CXX_ABI_H) && defined(HAVE_EXECINFO_H)
59 int size = backtrace(trace, sizeof(trace) / sizeof(*trace));
60 char** symbols = backtrace_symbols(trace, size);