chrono
chrono copied to clipboard
Many (all?) IRR examples segfault on cleanup
I have noticed segfault on the final cleanup for every single demo_IRR*
that I tried. None seem to have a clean exit. For instance this is the gdb backtrace for demo_IRR_fourbar.cpp
, compiled with GCC 10.1.0 on linux using the following command:
g++ -I/usr/include/chrono/collision/bullet -I/usr/include/irrlicht -I/usr/include/chrono_irrlicht -I/usr/include/eigen3 demo_IRR_fourbar.cpp -lChronoEngine_irrlicht -lChronoEngine -lIrrlicht -std=c++20 -g -pthread
Thread 1 "a.out" received signal SIGSEGV, Segmentation fault.
0x00007ffff67c9a50 in free () from /usr/lib/libc.so.6
(gdb) backtrace
#0 0x00007ffff67c9a50 in free () from /usr/lib/libc.so.6
#1 0x00005555555785fa in std::_Sp_counted_ptr<chrono::ChBody*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x55555606a5f0)
at /usr/include/c++/10.1.0/bits/shared_ptr_base.h:380
#2 0x00007ffff7640556 in chrono::ChAssembly::RemoveAllBodies() () from /usr/lib/libChronoEngine.so
#3 0x00007ffff7640de3 in chrono::ChAssembly::Clear() () from /usr/lib/libChronoEngine.so
#4 0x00007ffff75fba3f in chrono::ChSystem::~ChSystem() () from /usr/lib/libChronoEngine.so
#5 0x000055555556944c in chrono::ChSystemNSC::~ChSystemNSC (this=0x7fffffffdba0, __in_chrg=<optimized out>)
at /usr/include/chrono/physics/ChSystemNSC.h:46
#6 0x0000555555567a70 in main (argc=1, argv=0x7fffffffdfa8) at demo_IRR_fourbar.cpp:95
This seems to support my aversion towards shared pointers and their (ab)use in the project, see: http://projectchrono.org/forum/?place=msg%2Fprojectchrono%2FehRXeSYRC8g%2Fio7x862tAgAJ ...or maybe I am just missing some compile flags?
why not pull the demo code out of the chrono project folder and built it as a separate project depends on chrono with the cmake file provided by chrono?