0001-Proper-detection-of-cxxabi.h-and-execinfo.h.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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
  5. The current code in webrtc/base/checks.cc assumes that if __GLIBCXX__ is
  6. defined and __UCLIBC__ is not defined, then both cxxabi.h and execinfo.h
  7. will be available.
  8. Unfortunately, this is not correct with the musl C library:
  9. - It defines __GLIBCXX__
  10. - It does not define __UCLIBC__ (it's not uClibc after all!)
  11. - But it also doesn't provide execinfo.h
  12. Therefore, in order to make things work properly, we switch to proper
  13. autoconf checks for cxxabi.h and execinfo.h, and only use the backtrace
  14. functionality if both are provided.
  15. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  16. ---
  17. configure.ac | 2 ++
  18. webrtc/base/checks.cc | 4 ++--
  19. 2 files changed, 4 insertions(+), 2 deletions(-)
  20. diff --git a/configure.ac b/configure.ac
  21. index acbb3e2..ff4c752 100644
  22. --- a/configure.ac
  23. +++ b/configure.ac
  24. @@ -45,6 +45,8 @@ AC_SUBST(GNUSTL_CFLAGS)
  25. # Borrowed from gst-plugins-bad
  26. AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-])
  27. +AC_CHECK_HEADERS([cxxabi.h execinfo.h])
  28. +
  29. # Based on gst-plugins-bad configure.ac and defines in
  30. # <chromium source>/build/config/BUILDCONFIG.gn and
  31. # webrtc/BUILD.gn
  32. diff --git a/webrtc/base/checks.cc b/webrtc/base/checks.cc
  33. index 49a31f2..05d23a6 100644
  34. --- a/webrtc/base/checks.cc
  35. +++ b/webrtc/base/checks.cc
  36. @@ -16,7 +16,7 @@
  37. #include <cstdio>
  38. #include <cstdlib>
  39. -#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
  40. +#if defined(HAVE_CXX_ABI_H) && defined(HAVE_EXECINFO_H)
  41. #include <cxxabi.h>
  42. #include <execinfo.h>
  43. #endif
  44. @@ -55,7 +55,7 @@ void PrintError(const char* format, ...) {
  45. // to get usable symbols on Linux. This is copied from V8. Chromium has a more
  46. // advanced stace trace system; also more difficult to copy.
  47. void DumpBacktrace() {
  48. -#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
  49. +#if defined(HAVE_CXX_ABI_H) && defined(HAVE_EXECINFO_H)
  50. void* trace[100];
  51. int size = backtrace(trace, sizeof(trace) / sizeof(*trace));
  52. char** symbols = backtrace_symbols(trace, size);
  53. --
  54. 2.7.4