Bug 2187768

Summary: gcc: Adjust RPM dependencies for new std::cout etc. symbol versions
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 38CC: aoliva, dmalcolm, fweimer, jakub, jlaw, jwakely, mcermak, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-19 13:42:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
0001-Auto-generate-libstdc-dependency-for-iostream-symbol.patch
none
0001-Auto-generate-libstdc-dependency-for-iostream-symbol.patch none

Description Florian Weimer 2023-04-18 16:14:40 UTC
Upstream GCC recently added new symbol versions for std::cout etc. under the GLIBCXX_3.4.31 symbol version set.

As a result, rebuilt packages will fail to run until libstdc++ is updated because the installed libstdc++ version will provide libstdc++.so.6(GLIBCXX_3.4.31)(64bit) (due to other symbols already existing at this version), but not (say) _ZSt4cerr@@GLIBCXX_3.4.31 specifically.

Given that Fedora 38 has already been released, I think we should provide a solution at the RPM dependency level to this, so that the required libstdc++ package updates happen automatically.

Comment 1 Florian Weimer 2023-04-18 16:19:17 UTC
Here is how glibc handles this situation: https://src.fedoraproject.org/rpms/glibc/blob/rawhide/f/glibc.req.in

Also see glibc_autorequires in glibc.spec.

We have fully automated this so that the under-development symbol version set always uses NVR-based dependencies in addition to symbol-based dependencies. This is probably not needed for gcc, a one-off for GLIBCXX_3.4.31 is probably sufficient.

Comment 2 Florian Weimer 2023-04-19 07:33:04 UTC
Created attachment 1958225 [details]
0001-Auto-generate-libstdc-dependency-for-iostream-symbol.patch

Untested patch, based on what we have in glibc (but less dynamic).

Comment 3 Florian Weimer 2023-04-19 10:25:20 UTC
Created attachment 1958267 [details]
0001-Auto-generate-libstdc-dependency-for-iostream-symbol.patch

Fixed patch to use install -D, and to cover copy relocations. Lightly tested, final tests still pending.

Comment 4 Florian Weimer 2023-04-19 11:34:42 UTC
(In reply to Florian Weimer from comment #3)
> Created attachment 1958267 [details]
> 0001-Auto-generate-libstdc-dependency-for-iostream-symbol.patch
> 
> Fixed patch to use install -D, and to cover copy relocations. Lightly
> tested, final tests still pending.

This patch passed my testing.

However, /usr/bin/cmake (no arguments, no CMakeLists.txt file) crashes:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b41fba in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) ()
   from /lib64/libstdc++.so.6
(gdb) bt
#0  0x00007ffff7b41fba in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) ()
   from /lib64/libstdc++.so.6
#1  0x00007ffff7b4296c in std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) () from /lib64/libstdc++.so.6
#2  0x0000555555628f61 in cmDocumentationFormatter::PrintSection(std::basic_ostream<char, std::char_traits<char> >&, cmDocumentationSection const&) ()
#3  0x000055555560a5a5 in (anonymous namespace)::do_cmake(int, char const* const*) ()
#4  0x00005555555ebae0 in main ()

This does not seem related to my change or the way I patched GCC for building, though.

Comment 5 Florian Weimer 2023-04-19 13:42:11 UTC
Looks like we won't need this after all because the changes were reverted for GCC 13.1, and GCC 13.2 will have to use a separate symbol set (but symbol aliases won't work for these global variables). Maybe another time. 🥲