diff --git a/CMakeLists.txt b/CMakeLists.txt index cdb0dc9d..5dd1844b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,7 @@ elseif(APPLE) find_package(Freetype REQUIRED) find_library(APPKIT_LIBRARY AppKit REQUIRED) else() # Linux and compatible systems + find_package(Backtrace) find_package(SpaceWare) # Use freedesktop's pkg-config to locate everything. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9ec43b95..4de85d11 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -216,6 +216,11 @@ if(SPACEWARE_FOUND) ${SPACEWARE_LIBRARIES}) endif() +if(Backtrace_FOUND) + target_link_libraries(solvespace + ${Backtrace_LIBRARIES}) +endif() + if(APPLE) foreach(lib ${platform_BUNDLED_LIBS}) get_filename_component(name ${lib} NAME) diff --git a/src/platform/unixutil.cpp b/src/platform/unixutil.cpp index 31366dd8..ed0789a9 100644 --- a/src/platform/unixutil.cpp +++ b/src/platform/unixutil.cpp @@ -31,6 +31,7 @@ void assert_failure(const char *file, unsigned line, const char *function, fprintf(stderr, "File %s, line %u, function %s:\n", file, line, function); fprintf(stderr, "Assertion '%s' failed: ((%s) == false).\n", message, condition); +#ifndef LIBRARY static void *ptrs[1024] = {}; size_t nptrs = backtrace(ptrs, sizeof(ptrs) / sizeof(ptrs[0])); char **syms = backtrace_symbols(ptrs, nptrs); @@ -45,6 +46,7 @@ void assert_failure(const char *file, unsigned line, const char *function, fprintf(stderr, "%2zu: %p\n", i, ptrs[i]); } } +#endif abort(); }