MeshLib
MeshLib copied to clipboard
Use backtrace as a backend for boost-stacktrace
Currently, stacktrace on linux does not provide numbers of lines. This is correct default behavior according to boost documentation, which could be modified by a flag: BOOST_STACKTRACE_USE_BACKTRACE.
However, I have experienced some issues when trying to introduce this flag in MeshLib (#3036). Namely, it works only if compiled twice.
Steps to reproduce
- Build
ubuntu22container from thedockerfolder - Inside the container, run
git clone --recursive https://github.com/MeshInspector/MeshLib.git
cd MeshLib
git switch boost-use-backtrace
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j12
- The branch asserts on application start-up, therefore a stacktrace is printed. This build, however, does not produce line numbers. The application can be started with the following commad:
./bin/MeshViewer. - Then, run the following command:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DMESHINSPECTOR_CUDA_SUPPORT=OFF && make -j12(the important part is to change configuration somehow, the problem does not seem to be related to cuda specifically and the similar result could be achieved by modifying sources). - This time, if started, the application produces a stacktrace with line numbers.
- We can do the same thing in reverse: first time compile with
MESHINSPECTOR_CUDA_SUPPORT=OFFand second time without this flag, and the result will be equivalent: first-time build does not print line numbers, and second-time build does.
Thoughts
I failed to produce a MRE. Simple programs with backtrace and boost_backtrace work as expected. I think the problem is somehow related to PCH, but have not yet justified this claim.