mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
libstdc++ defines __cpp_lib_stacktrace from GCC 13 on, but the implementation lives in libstdc++exp, which some distributions do not ship (Red Hat's gcc-toolset among them). The header-only feature test then reports the feature as present and the link fails with undefined references to std::__stacktrace_impl::_S_current. Add cmake/StdStacktrace.cmake, which probes the feature by actually linking: first with no extra library, then with stdc++exp. The result selects the link library through RESINSIGHT_STACKTRACE_LIBRARIES, or defines RIA_HAS_STD_STACKTRACE=0 project-wide when neither links, so the crash handler compiles out its stack-trace capture and logs the signal only. RiaMainTools.cpp and RiaOpenTelemetryManager.h now honour a RIA_HAS_STD_STACKTRACE definition from the build system and only include <stacktrace> when the feature is enabled. Follow-up to #14045.