blob: 92af6ad305bd63c3288a3bdee32718480cfb724e (
plain)
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
|
From b87798fe9fed746e98871aaa10978324e4b9378f Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Tue, 1 Mar 2022 21:29:32 +0000
Subject: [PATCH] Fix musl build by checking whether execinfo.h's backtrace is
present
Closes: https://github.com/odamex/odamex/issues/533
(cherry picked from commit df3f5976416d342198879db80e4bf35f69eb2ed7)
---
common/CMakeLists.txt | 9 +++++++++
common/i_crash_noop.cpp | 2 +-
common/i_crash_posix.cpp | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 2850607e5..8d02b3212 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -6,3 +6,12 @@ configure_file(git_describe.h.in "${CMAKE_CURRENT_BINARY_DIR}/git_describe.h")
add_library(odamex-common INTERFACE)
target_sources(odamex-common INTERFACE ${COMMON_SOURCES} ${COMMON_HEADERS})
target_include_directories(odamex-common INTERFACE . ${CMAKE_CURRENT_BINARY_DIR})
+
+if(UNIX)
+ include(CheckSymbolExists)
+ check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE)
+
+ if(HAVE_BACKTRACE)
+ target_compile_definitions(odamex-common INTERFACE HAVE_BACKTRACE)
+ endif()
+endif()
diff --git a/common/i_crash_noop.cpp b/common/i_crash_noop.cpp
index 4eb8e70f4..84a406fb3 100644
--- a/common/i_crash_noop.cpp
+++ b/common/i_crash_noop.cpp
@@ -23,7 +23,7 @@
#if defined _WIN32 && !defined _XBOX && defined _MSC_VER && !defined _DEBUG
-#elif defined UNIX && !defined GEKKO
+#elif defined UNIX && defined HAVE_BACKTRACE && !defined GEKKO
#else
#include "odamex.h"
diff --git a/common/i_crash_posix.cpp b/common/i_crash_posix.cpp
index 8e6270872..4bf8727f6 100644
--- a/common/i_crash_posix.cpp
+++ b/common/i_crash_posix.cpp
@@ -22,7 +22,7 @@
//-----------------------------------------------------------------------------
-#if defined UNIX && !defined GCONSOLE
+#if defined UNIX && defined HAVE_BACKTRACE && !defined GCONSOLE
#include "odamex.h"
--
2.34.1
|