Skip to content

Commit d09378c

Browse files
committed
Use execinfo.h by default for clang/apple clang on macos, #161
1 parent f9ab949 commit d09378c

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,15 @@ if(
116116
)
117117
)
118118
# Attempt to auto-config
119-
if(UNIX)
119+
if(APPLE AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
120+
if(HAS_EXECINFO)
121+
set(CPPTRACE_UNWIND_WITH_EXECINFO On)
122+
message(STATUS "Cpptrace auto config: Using execinfo.h for unwinding")
123+
else()
124+
set(CPPTRACE_UNWIND_WITH_NOTHING On)
125+
message(FATAL_ERROR "Cpptrace auto config: No unwinding back-end seems to be supported, stack tracing will not work. To compile anyway set CPPTRACE_UNWIND_WITH_NOTHING.")
126+
endif()
127+
elseif(UNIX)
120128
if(HAS_UNWIND)
121129
set(CPPTRACE_UNWIND_WITH_UNWIND On)
122130
message(STATUS "Cpptrace auto config: Using libgcc unwind for unwinding")

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,12 +1051,12 @@ Unwinding, symbol resolution, and demangling.
10511051
The library's CMake automatically configures itself for what your system supports. The ideal configuration is as
10521052
follows:
10531053

1054-
| Platform | Unwinding | Symbols | Demangling |
1055-
| -------- | ------------- | ------------------ | -------------------- |
1056-
| Linux | `_Unwind` | libdwarf | cxxabi.h |
1057-
| MacOS | `_Unwind` | libdwarf | cxxabi.h |
1058-
| Windows | `StackWalk64` | dbghelp | No demangling needed |
1059-
| MinGW | `StackWalk64` | libdwarf + dbghelp | cxxabi.h |
1054+
| Platform | Unwinding | Symbols | Demangling |
1055+
| -------- | ------------------------------------------------------- | ------------------ | -------------------- |
1056+
| Linux | `_Unwind` | libdwarf | cxxabi.h |
1057+
| MacOS | `_Unwind` for gcc, execinfo.h for clang and apple clang | libdwarf | cxxabi.h |
1058+
| Windows | `StackWalk64` | dbghelp | No demangling needed |
1059+
| MinGW | `StackWalk64` | libdwarf + dbghelp | cxxabi.h |
10601060

10611061
Support for these back-ends is the main development focus and they should work well. If you want to use a different
10621062
back-end such as addr2line, for example, you can configure the library to do so.

0 commit comments

Comments
 (0)