Only enable backtrace on GLIBC linux systems

This commit is contained in:
Alex O'Connell 2024-07-30 20:44:56 -04:00
parent 268c566006
commit c6a7c8edef
2 changed files with 6 additions and 2 deletions

View file

@ -175,6 +175,11 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
check_include_file_cxx(execinfo HAVE_EXECINFO)
if (HAVE_EXECINFO)
add_compile_definitions(GLIBC_BACKTRACE_SUPPORTED)
endif()
#
# build the library
#
@ -207,7 +212,6 @@ set(GGML_PUBLIC_HEADERS
include/ggml-alloc.h
include/ggml-backend.h
include/ggml-blas.h
include/ggml-cann.h
include/ggml-cuda.h
include/ggml.h
include/ggml-kompute.h

View file

@ -185,7 +185,7 @@ static void ggml_print_backtrace_symbols(void) {
fprintf(stderr, "%d: %p %s\n", idx, addr, symbol);
}
}
#elif defined(__linux__)
#elif defined(__linux__) && defined(GLIBC_BACKTRACE_SUPPORTED)
#include <execinfo.h>
static void ggml_print_backtrace_symbols(void) {
void * trace[100];