https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105678

            Bug ID: 105678
           Summary: Undefined reference to stacktrace standard library
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fcolecumberri at hotmail dot com
  Target Milestone: ---

I'm trying to test the stacktrace C++23 feature by creating the next program:

```c++
#include <stacktrace>

int main(){
        std::stacktrace::current();
        return 0;
}
```

using the next g++:

```
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/franky/Descargas/gcc-libs/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-linker-build-id --enable-lto
--enable-multilib --enable-plugin --enable-shared --enable-threads=posix
--disable-libssp --disable-libstdcxx-pch --disable-werror
--with-build-config=bootstrap-lto --enable-link-serialization=1
--enable-libstdcxx-backtrace=yes
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)
```

Notice I added the `--enable-libstdcxx-backtrace=yes`

with this command:

```bash
g++ -std=gnu++2b cpp_file.cpp
```

And I get the next output:

```
/usr/bin/ld: a-cpp_file.o: in function `std::stacktrace_entry::_S_init()':
cpp_file.cpp:(.text._ZNSt16stacktrace_entry7_S_initEv[_ZNSt16stacktrace_entry7_S_initEv]+0x4a):
undefined reference to `__glibcxx_backtrace_create_state'
/usr/bin/ld: a-cpp_file.o: in function
`std::basic_stacktrace<std::allocator<std::stacktrace_entry>
>::current(std::allocator<std::stacktrace_entry> const&)':
cpp_file.cpp:(.text._ZNSt16basic_stacktraceISaISt16stacktrace_entryEE7currentERKS1_[_ZNSt16basic_stacktraceISaISt16stacktrace_entryEE7currentERKS1_]+0x70):
undefined reference to `__glibcxx_backtrace_simple'
collect2: error: ld returned 1 exit status
```

Maybe I am missing something, maybe the documentation is missing something, or
maybe this is still very experimental.

Reply via email to