Skip to content

Commit

Permalink
[FIXED] Build: failure with Android NDK (#830)
Browse files Browse the repository at this point in the history
When building against Android NDK testsuit compilation fails due to
missing execinfo.h/backtrace implementation in platforms with id less
than 33. Because this is only in tests just checking for Android should
be enough to keep things simple.
  • Loading branch information
mtmk authored Jan 15, 2025
1 parent d814c7a commit e4a05a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -37033,12 +37033,22 @@ void test_StanSubTimeout(void)

#ifndef _WIN32
static void _sigsegv_handler(int sig) {

// Android doesn't support backtrace before API Level 33.
// Because this is for tests it's good enough to check
// for Android only, until there is need for a better solution.
#ifndef ANDROID
void *array[20];
int size = backtrace(array, 20);
#endif // ANDROID

// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);

#ifndef ANDROID
backtrace_symbols_fd(array, size, STDERR_FILENO);
#endif // ANDROID

exit(1);
}
#endif // _WIN32
Expand Down

0 comments on commit e4a05a6

Please sign in to comment.