Closed ldeng-ustc closed 2 years ago
I've been struggling with this too today. It looks like something changed with the b2 build process between boost 1.77 and 1.78. In trying to solve this problem, I tried to link to libboost_stacktrace_backtrace
and found that it wasn't being copied out of b2 build's staging area either.
Since boost::stacktrace is supposed to be header only, a hack for now is to include the .ipp
file for your unwinding implementation in one source file in your project, and then also globally defining which implementation to use.
In my case with libbacktrace:
// put this in one source file
#include <boost/stacktrace/detail/frame_unwind.ipp>
// define this globally
BOOST_STACKTRACE_USE_BACKTRACE=1
and also link with libbacktrace and libdl
As a workaround include #include "boost/stacktrace.hpp"
instead of #include "boost/stacktrace/stacktrace.hpp"
https://godbolt.org/z/KPTxaM1sn
Will fix the issue in a few days
Just build the simplest example:
And get the link error:
Add
-ldl
flag does not change any thing.I have to build
stacktrace
library and add-DBOOST_STACKTRACE_LINK -lboost_stacktrace_backtrace -ldl -lbacktrace
, but in document,stacktrack
is header-only by defaults, so what's wrong?I run these on Ubuntu 20.04 in WSL2, and gcc version 9.3.0, and boost version is 1.77.0. And I find similar issue in stackoverflow(ru)