[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1065359: libstdc++-13-dev: missing libstdc++_libbacktrace.a for stacktrace



Package: libstdc++-13-dev
Version: 13.2.0-13
Severity: normal

Dear maintainer,

I'm trying a stacktrace feature from C++23:
g++-13 can compile my program because <stacktrace> is present,
but fails to link with errors:
undefined reference to `__glibcxx_backtrace_create_state'
undefined reference to `__glibcxx_backtrace_pcinfo'
undefined reference to `__glibcxx_backtrace_syminfo'
undefined reference to `__glibcxx_backtrace_simple'

Minimal working example can be found here (from cppreference.com):
https://godbolt.org/z/8zc59Y1Wv

Copy-paste it here:

//g++ -std=c++23 -lstdc++_libbacktrace -O1 -Wall -o bt bt.cpp
#include <stacktrace>
#include <iostream>

int nested_func(int c)
{
    std::cout << std::stacktrace::current() << '\n';
    return c + 1;
}

int func(int b)
{
    return nested_func(b + 1);
}

int main()
{
    std::cout << func(777);
}

I found that libstdc++_libbacktrace.a is absent even though libstdc++-13-dev is installed.

I see that libstdc++-13-dev for other architectures include the support:
lib32stdc++-13-dev: /usr/lib/gcc/x86_64-linux-gnu/13/32/libstdc++_libbacktrace.a
libx32stdc++-13-dev: /usr/lib/gcc/x86_64-linux-gnu/13/x32/libstdc++_libbacktrace.a

But there is no equivalent static library for the default x86_64 (amd64).
It's very strange that 32 and x32 have it (even some GCC cross compilers ship it), but not the default.

Also the supporting C library is already installed:
libgcc-13-dev:amd64: /usr/lib/gcc/x86_64-linux-gnu/13/libbacktrace.a

So it seems that most of the hard work (libbacktrace) is done, but the standard C++ part is missing.

I guess the root cause is that --enable-backtrace was not present when building libstdc++-13-dev.
I hope it can be easily fixed by just adding that extra argument to your build scripts.

Thank you for the hard work and best regards,
Marius

-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (900, 'testing'), (500, 'stable-updates'), (500, 'stable'), (50, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.6.15-amd64 (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libstdc++-13-dev depends on:
ii  gcc-13-base    13.2.0-13
ii  libc6-dev      2.37-15
ii  libgcc-13-dev  13.2.0-13
ii  libstdc++6     14-20240201-3

libstdc++-13-dev recommends no packages.

Versions of packages libstdc++-13-dev suggests:
pn  libstdc++-13-doc  <none>

-- debconf-show failed


Reply to: