Closed opelx closed 3 years ago
If your Linux distro does not have a package with backtrace.h
header then you have to manually install the libbacktrace from sources. References to that library are awailable on the same docs page
Thanks for your answer. I'm using CMake with FindBoost which fails to find backtrace.h. This library hasn't CMake support (probably will never get) out of the box. I have to build it into 3rd party dependency. All this results into an effort, which may comes obsolete since the offical linux libc way seems to be to use
backtrace_symbols
from execinfo.h
just uses dlsym
without demangling C++ symbols https://code.woboq.org/userspace/glibc/debug/backtracesyms.c.html
In other words, it is slightly worse than the default boost_stacktrace_basic https://www.boost.org/doc/libs/1_75_0/doc/html/stacktrace/configuration_and_build.html
If anybody encounters this problem on Arch Linux or any of it's derivatives, you can find libbacktrace in the AUR: https://aur.archlinux.org/packages/libbacktrace-git
Thank you. I close the issue. I have to include lib backtrace into my build process somehow if I want to get better traces than boost_stacktrace_basic.
backtrace_symbols
fromexecinfo.h
just usesdlsym
without demangling C++ symbols https://code.woboq.org/userspace/glibc/debug/backtracesyms.c.htmlIn other words, it is slightly worse than the default boost_stacktrace_basic https://www.boost.org/doc/libs/1_75_0/doc/html/stacktrace/configuration_and_build.html
But with __cxa_demangle
it's very nice! At least for GCC... It'll be nice to have it as another alternative in the Boost::stacktrace library, please ;)
I found my way to this issue after discovering that CMake's FindBacktrace module points at <execinfo.h>
and libbacktrace is not available for me to install.
An implementation that uses <execinfo.h>
and __cxa_demangle
would be very welcome improvement over the boost_stacktrace_basic
implementation.
Also with CMake, I had the problem of find_path
not searching the internal include paths.
This can help with that:
find_path(BACKTRACE_INCLUDE backtrace.h
HINTS ${CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS}
REQUIRED)
giving e.g.
BACKTRACE_INCLUDE:PATH=/usr/lib/gcc/x86_64-linux-gnu/12/include
Compiling stacktrace on Linux (here fedora33 witj Clang 11) fails due to missing header backtrace.h. The official documentation states that there shall be a header:
but there isn't:
It seems, that this statement is old, a similar problem is shown FS#50262 - [gcc] GCC ships without libbacktrace. My package system doesn't show any additional backtrace or stacktrace packages related to gcc..
man backtrace
refers toWhat is the state on linux this time? Or miss I something?