3

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.

Desmond Gold
  • 1,517
  • 1
  • 7
  • 19
  • This is now fixed on Compiler Explorer - you still need to link against stdc++_backtrace though - https://godbolt.org/z/We4T8f4q8 – Matt Godbolt Oct 18 '22 at 14:56

1 Answers1

4

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
David Grayson
  • 84,103
  • 24
  • 152
  • 189