1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
From 4b2c73ad056aa327dc3b505410da68cf384317ba Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Mon, 16 May 2016 22:26:05 +0200
Subject: [PATCH] Make backtrace support depends on execinfo.h existence
In some C-libraries (like uclibc), backtrace support is optional, so the
execinfo.h file may not exist.
This change adds the check for execinfo.h header and conditionnaly enable
backtrace support.
This issue has been triggered by Buildroot farms:
http://autobuild.buildroot.org/results/391/391e71a988250ea66ec4dbee6f60fdce9eaf2766/build-end.log
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
dbus/sigsegv.c | 8 +++++++-
wscript | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c
index ee12f91..0b31d89 100644
--- a/dbus/sigsegv.c
+++ b/dbus/sigsegv.c
@@ -27,7 +27,9 @@
#include <stdio.h>
#include <signal.h>
#include <dlfcn.h>
-#include <execinfo.h>
+#if defined(HAVE_EXECINFO_H)
+# include <execinfo.h>
+#endif /* defined(HAVE_EXECINFO_H) */
#include <errno.h>
#ifndef NO_CPP_DEMANGLE
char * __cxa_demangle(const char * __mangled_name, char * __output_buffer, size_t * __length, int * __status);
@@ -161,12 +163,16 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
bp = (void**)bp[0];
}
#else
+# if defined(HAVE_EXECINFO_H)
jack_error("Stack trace (non-dedicated):");
sz = backtrace(bt, 20);
strings = backtrace_symbols(bt, sz);
for(i = 0; i < sz; ++i)
jack_error("%s", strings[i]);
+# else /* defined(HAVE_EXECINFO_H) */
+ jack_error("Stack trace not available");
+# endif /* defined(HAVE_EXECINFO_H) */
#endif
jack_error("End of stack trace");
exit (-1);
diff --git a/wscript b/wscript
index aef4bd8..63ba3aa 100644
--- a/wscript
+++ b/wscript
@@ -166,6 +166,7 @@ def configure(conf):
if conf.env['BUILD_JACKDBUS'] != True:
conf.fatal('jackdbus was explicitly requested but cannot be built')
+ conf.check_cc(header_name='execinfo.h', define_name="HAVE_EXECINFO_H", mandatory=False)
conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
if conf.is_defined('HAVE_SAMPLERATE'):
--
2.8.2
|