boostorg / stacktrace

C++ library for storing and printing backtraces.
https://boost.org/libs/stacktrace
422 stars 70 forks source link

clang and libbacktrace detection #115

Closed bgemmill closed 2 years ago

bgemmill commented 2 years ago

I'm trying to build boost with clang and get the library boost_stacktrace_backtrace at the end.

If we use a process like this to just build stacktrace:

./bootstrap.sh --with-toolset=clang
cd libs/stacktrace/build
../../../b2 -a libbacktrace

We get the error: ../../../libs/stacktrace/build/has_backtrace.cpp:7:10: fatal error: 'backtrace.h' file not found

Which makes sense, given that backtrace.h lives in gcc's library location, and not clang's.

The issue is that there does not seem to be a set of b2 options that will fix this issue for clang, because has_backtrace.cpp does not use BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE like the rest of stacktrace does.

This means that even if a user tries to point b2 to libbacktrace via define=BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=... as documented here, has_backtrace.cpp will still fail to detect anything.

Could has_backtrace.cpp please be changed to use BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE?

apolukhin commented 2 years ago

Many thanks for the bugreport!

bgemmill commented 2 years ago

Thanks for fixing that!