Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2220896

Summary: undefined reference for libstdc++ symbol when using GCC toolset 11
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: gccAssignee: Marek Polacek <mpolacek>
gcc sub component: gcc-toolset-11 QA Contact: Václav Kadlčík <vkadlcik>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ahajkova, fweimer, jakub, mpolacek, ohudlick, sipoyare, vikpatil, vkadlcik
Version: 8.6Keywords: Bugfix, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-toolset-11-gcc-11.2.1-9.2.el8_6 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-29 09:12:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paulo Andrade 2023-07-06 13:05:29 UTC
User is experiencing the upstream issue.

$ scl enable gcc-toolset-11 bash
$ tar jxf boost_1_79_0.tar.bz2
$ cd boost_1_79_0
$ ./bootstrap.sh
...

$ cat ../user-config.jam
using gcc : : g++ : <cxxflags>"-flto" ;
$ ./b2 --with-program_options link=static --user-config=$PWD/../user-config.jam
...

$ cd ..
$ cat test.cpp
#include <boost/asio/spawn.hpp>
#include <boost/program_options.hpp>
#include <iostream>

int
main()
{
    auto generic = boost::program_options::options_description{};
    std::cout << generic;
}

$  g++ -o /dev/null test.cpp -Iboost_1_79_0 boost_1_79_0/stage/lib/libboost_program_options.a -Os -flto
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /tmp/ccx7yv55.ltrans0.ltrans.o: in function `boost::program_options::options_description::get_option_column_width() const':
<artificial>:(.text+0x2449): undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_high_mark() const'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /tmp/ccx7yv55.ltrans0.ltrans.o: in function `boost::program_options::(anonymous namespace)::format_one(std::ostream&, boost::program_options::option_description const&, unsigned int, unsigned int) [clone .constprop.0]':
<artificial>:(.text+0x2822): undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_high_mark() const'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: <artificial>:(.text+0x28bf): undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_high_mark() const'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: <artificial>:(.text+0x376f): undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_high_mark() const'
collect2: error: ld returned 1 exit status


  Manually adding 
  I can reproduce the issue, and adding https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff;f=libstdc%2B%2B-v3/include/std/sstream;h=bc7d636e702ea4352a182cc521fd32a06ca31b6f;hp=bb25c2c69a94f8fc325289ab7267e91c5b846121;hb=d47c4f0f1da0aa84097878b82e100d08deb6d950;hpb=6666ca1ab44ad8a61e2b916cf4173fe452b78ed6
to /opt/rh/gcc-toolset-11/root/usr/include/c++/11/sstream corrects the problem.

Comment 1 Marek Polacek 2023-07-06 15:51:37 UTC
The fix is in 11.4 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105671#c9 so I think it makes sense to backport it.

Comment 11 errata-xmlrpc 2023-08-29 09:12:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (gcc-toolset-11-gcc bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:4797