summaryrefslogtreecommitdiff
path: root/dev-libs/sink/files/sink-0.8.0-musl-execinfo.patch
blob: b5085702a33e63533f155840c7f6786dc0e8e729 (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
# Since musl doesn't have execinfo. We're going to avoid including it and make
# the printStacktrace function void
# Closes: https://bugs.gentoo.org/830945
--- a/synchronizer/CMakeLists.txt
+++ b/synchronizer/CMakeLists.txt
@@ -2,6 +2,12 @@ project(sink_synchronizer)

 include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})

+INCLUDE(CheckIncludeFiles)
+CHECK_INCLUDE_FILES("execinfo.h" HAVE_EXECINFO)
+IF (HAVE_EXECINFO)
+	add_compile_definitions(HAVE_EXECINFO_H)
+ENDIF(HAVE_EXECINFO)
+
 set(sinksynchronizer_SRCS
     main.cpp
     backtrace.cpp
--- a/synchronizer/backtrace.cpp
+++ b/synchronizer/backtrace.cpp
@@ -31,7 +31,9 @@
 #include <chrono>

 #ifndef Q_OS_WIN
+#ifdef HAVE_EXECINFO_H
 #include <execinfo.h>
+#endif // HAVE_EXECINFO_H
 #include <unistd.h>
 #include <cxxabi.h>
 #include <dlfcn.h>
@@ -143,7 +145,7 @@ private:
 //Print a demangled stacktrace
 static void printStacktrace()
 {
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && defined(HAVE_EXECINFO_H)
     int skip = 1;
 	void *callstack[128];
 	const int nMaxFrames = sizeof(callstack) / sizeof(callstack[0]);
@@ -178,7 +180,7 @@ static void printStacktrace()
 		trace_buf << "[truncated]\n";
     }
     std::cerr << trace_buf.str();
-#else
+#elif defined(Q_OS_WIN)
     enum { maxStackFrames = 100 };
     DebugSymbolResolver resolver(GetCurrentProcess());
     if (resolver.isValid()) {