Use execinfo.h by default for clang/apple clang on macos, #161

This commit is contained in:
Jeremy Rifkin 2024-09-12 23:56:09 -05:00
parent f9ab949a9e
commit d09378c8e8
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
2 changed files with 15 additions and 7 deletions

View File

@ -116,7 +116,15 @@ if(
) )
) )
# Attempt to auto-config # Attempt to auto-config
if(UNIX) if(APPLE AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
if(HAS_EXECINFO)
set(CPPTRACE_UNWIND_WITH_EXECINFO On)
message(STATUS "Cpptrace auto config: Using execinfo.h for unwinding")
else()
set(CPPTRACE_UNWIND_WITH_NOTHING On)
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.")
endif()
elseif(UNIX)
if(HAS_UNWIND) if(HAS_UNWIND)
set(CPPTRACE_UNWIND_WITH_UNWIND On) set(CPPTRACE_UNWIND_WITH_UNWIND On)
message(STATUS "Cpptrace auto config: Using libgcc unwind for unwinding") message(STATUS "Cpptrace auto config: Using libgcc unwind for unwinding")

View File

@ -1052,9 +1052,9 @@ The library's CMake automatically configures itself for what your system support
follows: follows:
| Platform | Unwinding | Symbols | Demangling | | Platform | Unwinding | Symbols | Demangling |
| -------- | ------------- | ------------------ | -------------------- | | -------- | ------------------------------------------------------- | ------------------ | -------------------- |
| Linux | `_Unwind` | libdwarf | cxxabi.h | | Linux | `_Unwind` | libdwarf | cxxabi.h |
| MacOS | `_Unwind` | libdwarf | cxxabi.h | | MacOS | `_Unwind` for gcc, execinfo.h for clang and apple clang | libdwarf | cxxabi.h |
| Windows | `StackWalk64` | dbghelp | No demangling needed | | Windows | `StackWalk64` | dbghelp | No demangling needed |
| MinGW | `StackWalk64` | libdwarf + dbghelp | cxxabi.h | | MinGW | `StackWalk64` | libdwarf + dbghelp | cxxabi.h |