Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use <stacktrace> in GCC trunk?

From https://github.com/gcc-mirror/gcc/commit/3acb929cc0beb79e6f4005eb22ee88b45e1cbc1d commit, C++ standard header <stacktrace> exists things such as std::stacktrace_entry but is not declared since _GLIBCXX_HAVE_STACKTRACE is not defined neither.

I have tried this on https://godbolt.org/z/b9TvEMYnh but linker error is emitted once I have added the argument -lstd++_libbacktrace (ofc, it was not found)

#include <stacktrace> // header found

int main() {
  // can't use features like 'std::stacktrace_entry' and 'std::stacktrace'
}

What does this message mean from the commit description? :

For now, the new library is only built if --enable-libstdcxx-backtrace=yes is used.

like image 958
Desmond Gold Avatar asked Sep 01 '25 22:09

Desmond Gold


1 Answers

Part of building GCC from source is to run the configure shell script and pass it a bunch of arguments to tell it how to behave. That commit message is telling you that in order to enable this feature, you must add the following configure argument:

--enable-libstdcxx-backtrace=yes
like image 65
David Grayson Avatar answered Sep 03 '25 12:09

David Grayson