Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 922934 - sys-devel/gcc: please add USE flag to enable "libstdcxx-backtrace" at emerge time
Summary: sys-devel/gcc: please add USE flag to enable "libstdcxx-backtrace" at emerge ...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-26 01:22 UTC by Dennis Jenkins
Modified: 2024-01-26 20:22 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
All "config.log" files for "emerge =sys-devel/gcc-13.2.1_p20240113-r1" (gentoo-bug-922934-logs.tgz,79.63 KB, application/octet-stream)
2024-01-26 18:17 UTC, Dennis Jenkins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Jenkins 2024-01-26 01:22:04 UTC
gcc-12 and beyond provide support for the C++23 standard "include <stacktrace>" [1].  However, this feature must be enabled when GCC itself it built with the `--enable-libstdcxx-backtrace` flag [2].

Currently (2024-01-15) there is no USE flag in any GCC ebuild to enable this feature.  I humbly ask that such a flag be added (at least for GCC 13 and 14).

Without it, the `std::stacktrace` mechanism fails to compile in code that wants to use it (such as my own project). 

Passing `--enable-libstdcxx-backtrace` to configure when building GCC should result in the following changes:

1. The symbol `_GLIBCXX_HAVE_STACKTRACE` being defined in .../c++config.h [3]
2. The build and installation of the library `stdc++_libbacktrace` (until gcc14, then it is renamed [2, 4]).

Thank you very much for your consideration.


[1] https://en.cppreference.com/w/cpp/header/stacktrace

[2] https://stackoverflow.com/a/72342952

[3]
 $ grep _GLIBCXX_HAVE_STACKTRACE /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/x86_64-pc-linux-gnu/bits/c++config.h 
/* #undef _GLIBCXX_HAVE_STACKTRACE */

[4] https://gcc.gnu.org/onlinedocs/libstdc++/manual/using.html#manual.intro.using.flags
Comment 1 Arsen Arsenović gentoo-dev 2024-01-26 17:42:33 UTC
oddly, this macro is set to 1 on my system.  could you post gcc config logs?
Comment 2 Dennis Jenkins 2024-01-26 18:17:01 UTC
Created attachment 883191 [details]
All "config.log" files for "emerge =sys-devel/gcc-13.2.1_p20240113-r1"
Comment 3 Dennis Jenkins 2024-01-26 18:19:31 UTC
Odd, it appears to be building libbacktrace though.  But it did not get installed when I tried this 2 days ago.

/var/tmp/portage/sys-devel/gcc-13.2.1_p20240113-r1/work/build/libbacktrace # ls -l *.o
-rw-r--r-- 1 portage portage   960 Jan 26 10:10 atomic.o
-rw-r--r-- 1 portage portage  2168 Jan 26 10:10 backtrace.o
-rw-r--r-- 1 portage portage 39920 Jan 26 10:10 dwarf.o
-rw-r--r-- 1 portage portage 52728 Jan 26 10:10 elf.o
-rw-r--r-- 1 portage portage  3952 Jan 26 10:10 fileline.o
-rw-r--r-- 1 portage portage  2248 Jan 26 10:10 mmapio.o
-rw-r--r-- 1 portage portage  3720 Jan 26 10:10 mmap.o
-rw-r--r-- 1 portage portage  2128 Jan 26 10:10 posix.o
-rw-r--r-- 1 portage portage  2696 Jan 26 10:10 print.o
-rw-r--r-- 1 portage portage  1880 Jan 26 10:10 simple.o
-rw-r--r-- 1 portage portage  1856 Jan 26 10:10 sort.o
-rw-r--r-- 1 portage portage  1592 Jan 26 10:10 state.o


I'll re-run the emerge and see what happens (but I don't expect it to install the libstdc++backtrace.so, not set the symbol in c++config.h).
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-26 18:21:24 UTC
wait, what version of gcc before? I think I know what this is.
Comment 5 Dennis Jenkins 2024-01-26 18:23:24 UTC
I do not understand your question.  If you are asking what version of GCC I used to compile GCC?  I have tried building gcc-13 with both gcc-11 (libbacktrace not installed) and gcc-13 (libbacktrace still not installed).

I an redoing the emerge of gcc-13 using gcc-13 _right now_.  It should finish in a few minutes.  I can also hop onto IRC #gentoo and discuss there if that is a better method than posting near-real-time updates to this bug tracker.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-26 18:27:34 UTC
Hm, I was thinking of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111936. The other thing that Fedora hit was specific to them (so not worth me mentioning).
Comment 7 Dennis Jenkins 2024-01-26 18:41:03 UTC
emerge of gcc-13 (using gcc-13 as compiler) just finished:

# grep _GLIBCXX_HAVE_STACKTRACE /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/x86_64-pc-linux-gnu/bits/c++config.h 
/* #undef _GLIBCXX_HAVE_STACKTRACE */


It is interesting that there is no "libstdc++.so" installed...
# ls /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++*
/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.a
/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++exp.a
/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++exp.la
/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++fs.a
/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so
/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6
/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6.0.32

The GCC docs say that "stdc++libbacktrace" will be folded into "libstdc++exp" in GCC-14, so I would be surprised to find the backtrace stuff there in gcc-13.

# nm /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++exp.a  | grep -i backtrace
(no output)
Comment 8 Arsen Arsenović gentoo-dev 2024-01-26 20:22:48 UTC
I don't see the target-machine build directory logs (i.e. x86_64-pc-linux-gnu/libstdc++-v3 for instance) in the archive you posted.

ah, sorry for the confusion - this macro is set on my system *for gcc-14*.  I didn't pick up on this initially.  can reproduce, then