From 87ef7f69509fb95842b49fffce870ad6e0568282 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Thu, 15 Feb 2024 09:19:27 +0300 Subject: [PATCH] Fix build (failure was noted in #147) (#151) --- build/Jamfile.v2 | 4 ++++ doc/stacktrace.qbk | 4 ++-- src/from_exception.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 664ee24..6f4eec5 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -138,6 +138,10 @@ lib boost_stacktrace_from_exception : # requirements all linux:dl + windows:no # not supported at the moment + + # Require usable libbacktrace on other platforms + [ check-target-builds ../build//libbacktrace : : no ] : # default build : # usage-requirements #shared:BOOST_STACKTRACE_DYN_LINK=1 diff --git a/doc/stacktrace.qbk b/doc/stacktrace.qbk index 9223122..d31e888 100644 --- a/doc/stacktrace.qbk +++ b/doc/stacktrace.qbk @@ -133,8 +133,8 @@ Generic recommendation is to *avoid signal handlers! Use* platform specific ways [section Stacktrace from arbitrary exception] [warning At the moment the functionality is only available for some of the - popular cxx run-times for POSIX systems. Make sure that your platform - is supported by running some tests. + popular C++ runtimes for POSIX systems and requires *libbacktrace*. + Make sure that your platform is supported by running some tests. ] The library provides a way to get stacktrace from an exception as if the diff --git a/src/from_exception.cpp b/src/from_exception.cpp index d8802ef..7f2de57 100644 --- a/src/from_exception.cpp +++ b/src/from_exception.cpp @@ -6,6 +6,12 @@ #include "exception_headers.h" +// At the moment the file is used only on POSIX. _Unwind_Backtrace may be +// available on some platforms only if _GNU_SOURCE is defined. +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + #include #include