1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-19 17:25:17 +03:00
aports/testing/widelands/0002-linux-only-enable-backtrace-when-using-glibc.patch

45 lines
1.1 KiB
Diff

From 246452c8e0be506c27c2c192690f0a4b400916a3 Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Fri, 30 Jul 2021 23:43:16 -0700
Subject: [PATCH] linux: only enable backtrace when using glibc
backtrace and backtrace_symbols are in glibc, and not POSIX-compliant
libc (like musl).
---
src/logic/map_objects/backtrace.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/logic/map_objects/backtrace.cc b/src/logic/map_objects/backtrace.cc
index 71e1f4e332..011dc882a0 100644
--- a/src/logic/map_objects/backtrace.cc
+++ b/src/logic/map_objects/backtrace.cc
@@ -21,15 +21,18 @@
#ifndef _WIN32
#ifndef __APPLE__
+#if !defined(__linux__) || defined(__GLIBC__)
#include <execinfo.h>
#endif
#endif
+#endif
std::string get_backtrace() {
std::string result("Backtrace:\n");
#ifndef _WIN32
#ifndef __APPLE__
+#if !defined(__linux__) || defined(__GLIBC__)
#define BACKTRACE_STACKSIZE 24
void* stack[BACKTRACE_STACKSIZE];
@@ -41,6 +44,7 @@ std::string get_backtrace() {
}
free(list);
#endif
+#endif
#endif
return result;
}
--
2.32.0