wscript: make backtrace support depends on execinfo.h existence
In some C-libraries (like uclibc), backtrace support is optional, so the execinfo.h may not exist. This change adds the check for execinfo.h header and conditionaly 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>
This commit is contained in:
parent
ff0463bd5d
commit
8ac6bf1b4a
|
@ -27,7 +27,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <execinfo.h>
|
#ifdef HAVE_EXECINFO_H
|
||||||
|
# include <execinfo.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef NO_CPP_DEMANGLE
|
#ifndef NO_CPP_DEMANGLE
|
||||||
char * __cxa_demangle(const char * __mangled_name, char * __output_buffer, size_t * __length, int * __status);
|
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];
|
bp = (void**)bp[0];
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
# ifdef HAVE_EXECINFO_H
|
||||||
jack_error("Stack trace (non-dedicated):");
|
jack_error("Stack trace (non-dedicated):");
|
||||||
sz = backtrace(bt, 20);
|
sz = backtrace(bt, 20);
|
||||||
strings = backtrace_symbols(bt, sz);
|
strings = backtrace_symbols(bt, sz);
|
||||||
|
|
||||||
for(i = 0; i < sz; ++i)
|
for(i = 0; i < sz; ++i)
|
||||||
jack_error("%s", strings[i]);
|
jack_error("%s", strings[i]);
|
||||||
|
# else
|
||||||
|
jack_error("Stack trace not available");
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
jack_error("End of stack trace");
|
jack_error("End of stack trace");
|
||||||
exit (-1);
|
exit (-1);
|
||||||
|
|
6
wscript
6
wscript
|
@ -483,6 +483,12 @@ def configure(conf):
|
||||||
defines=['_GNU_SOURCE'],
|
defines=['_GNU_SOURCE'],
|
||||||
mandatory=False)
|
mandatory=False)
|
||||||
|
|
||||||
|
# Check for backtrace support
|
||||||
|
conf.check(
|
||||||
|
header_name='execinfo.h',
|
||||||
|
define_name='HAVE_EXECINFO_H',
|
||||||
|
mandatory=False)
|
||||||
|
|
||||||
conf.recurse('common')
|
conf.recurse('common')
|
||||||
if Options.options.dbus:
|
if Options.options.dbus:
|
||||||
conf.recurse('dbus')
|
conf.recurse('dbus')
|
||||||
|
|
Loading…
Reference in New Issue