Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The BOOST_STACKTRACE_HAS_BACKTRACE check doesn't seem to work with clang #197

Open
bgemmill opened this issue Dec 20, 2024 · 3 comments
Open

Comments

@bgemmill
Copy link

bgemmill commented Dec 20, 2024

When configuring cmake on ubuntu 24.04 with clang, the check for libbacktrace doesn't seem to work, even when libbacktrace is installed in the default location.

For reference, gcc puts libbacktrace here:
/usr/lib/gcc/x86_64-linux-gnu/13/include/backtrace.h

Configuring with clang, we see:

[build] -- Performing Test BOOST_STACKTRACE_HAS_BACKTRACE
[build] -- Performing Test BOOST_STACKTRACE_HAS_BACKTRACE - Failed

This can be corrected by explicitly telling the library where the header resides (the extra escapes are to pass the literal quotes all the way in to the header file as a define):

-DCMAKE_CXX_FLAGS="-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=\\\"/usr/lib/gcc/x86_64-linux-gnu/13/include/backtrace.h\\\""

Can the cmake check of BOOST_STACKTRACE_HAS_BACKTRACE be modified to look at the gcc install location?

@pdimov pdimov transferred this issue from boostorg/cmake Dec 20, 2024
@pdimov
Copy link
Member

pdimov commented Dec 20, 2024

Even if the check is modified to look somewhere not in the include path, the library would still not compile without passing -DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE:

#ifdef BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE
# include BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE
#else
# include <backtrace.h>
#endif

so what would be the point of modifying the check?

Does CMake's FindBacktrace module work on this configuration?

https://cmake.org/cmake/help/latest/module/FindBacktrace.html

Maybe the library needs to use that.

@bgemmill
Copy link
Author

bgemmill commented Jan 3, 2025

CMake's FindBacktrace does work, but detects this backtrace:

[cmake] -- Backtrace_HEADER execinfo.h
[cmake] -- Backtrace_INCLUDE_DIR /usr/include

Rather than the desired backtrace, and that looks like a different implementation.

@apolukhin does the backtrace in execinfo.h correspond to any of these?

@apolukhin
Copy link
Member

@apolukhin does the backtrace in execinfo.h correspond to any of these?

Unfortunately no. It is an inconvenient interface that uses the desired functions under the hood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants