Bug 1853900

Summary: typeinfo for std::codecvt_utf8<wchar_t, 1114111ul, (std::codecvt_mode)0> not found
Product: Red Hat Enterprise Linux 8 Reporter: Kefu Chai <kchai>
Component: gccAssignee: Marek Polacek <mpolacek>
gcc sub component: gcc-toolset-9 QA Contact: Alexandra Petlanová Hájková <ahajkova>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ahajkova, fweimer, jakub, mcermak, mnewsome, ohudlick, rzarzyns, sipoyare
Version: 8.2Keywords: Bugfix
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-toolset-9-gcc-9.2.1-2.3.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 04:14:36 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 Kefu Chai 2020-07-05 11:45:25 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. scl enable gcc-toolset-9 bash
2. # create a file named test.cc

#include <filesystem>

namespace fs = std::filesystem;
int main() {
    fs::create_directory("sandbox");
    fs::remove_all("sandbox");
}

3. g++ -std=c++17 test.cc

Actual results:

$ g++  -std=c++17 test.cc
/opt/rh/gcc-toolset-9/root/usr/bin/ld: a.out: hidden symbol `_ZTISt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE' isn't defined
/opt/rh/gcc-toolset-9/root/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

Expected results:

a.out is created in current directory.

Additional info:

$ dnf list installed gcc-toolset-9-gcc-c++
gcc-toolset-9-gcc-c++.x86_64     9.2.1-2.2.el8     @rhel-8-for-x86_64-appstream-rpms

$ c++filt _ZTISt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE
typeinfo for std::codecvt_utf8<wchar_t, 1114111ul, (std::codecvt_mode)0>

Comment 1 Marek Polacek 2020-07-07 13:28:43 UTC
A bug in gcc-toolset-9-gcc, along with these symbols:

+ grep -v __dso_handle
    26: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZNKSt5ctypeIcE8do_widenEc
   377: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED0Ev
   378: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED1Ev
   379: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED2Ev
   398: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZTISt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE
   403: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZTSSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE
   407: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZTVSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE
   344: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED0Ev
   345: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED1Ev
   346: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED2Ev
   367: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZTISt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE
   372: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZTSSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE
   376: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND _ZTVSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE

Comment 2 Marek Polacek 2020-07-07 15:29:08 UTC
This was already fixed in DTS 9.  I don't know if we have a chance to fix things in GTS 9 now.

commit 699fa8a2b8720fe04038c2d3afde13a3d31ee2fd
Author: Marek Polacek <polacek>
Date:   Thu Feb 6 15:37:51 2020 -0500

    Update gcc9-libstdc++-compat.patch re *codecvt_utf8*
    
    Since https://gcc.gnu.org/viewcvs?rev=272389&root=gcc&view=rev
    libstd++_nonshared.a no longer defines various *codecvt_utf8*
    symbols so let's remove their .hidden directives to keep the
    readelf ... | grep 'HIDDEN.*UND' check happy.

diff --git a/gcc.spec b/gcc.spec
index 5fb9e5b..6febdef 100644
--- a/gcc.spec
+++ b/gcc.spec
@@ -113,7 +113,7 @@
 Summary: GCC version 9
 Name: %{?scl_prefix}gcc
 Version: %{gcc_version}
-Release: %{gcc_release}.7%{?dist}
+Release: %{gcc_release}.8%{?dist}
 # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
 # GCC Runtime Exception.
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
@@ -2554,10 +2554,13 @@ fi
 %doc rpm.doc/changelogs/libcc1/ChangeLog*
 
 %changelog
-* Thu Nov 21 2019 Marek Polacek <polacek> 9.2.1-3.7
+* Thu Feb  6 2020 Marek Polacek <polacek> 9.2.1-3.8
+- remove a few *codecvt_utf8* symbols from gcc9-libstdc++-compat
+
+* Wed Jan 29 2020 Marek Polacek <polacek> 9.2.1-3.7
 - gcc9-libstdc++-compat fix: move _ZSt19__throw_ios_failurePKc
 
-* Thu Nov 21 2019 Marek Polacek <polacek> 9.2.1-3.6
+* Wed Jan 29 2020 Marek Polacek <polacek> 9.2.1-3.6
 - update from Fedora gcc-9.2.1-3 (#1783475)
 
 * Thu Nov 21 2019 Marek Polacek <polacek> 9.1.1-2.6
diff --git a/gcc9-libstdc++-compat.patch b/gcc9-libstdc++-compat.patch
index f6be669..b4cb5f7 100644
--- a/gcc9-libstdc++-compat.patch
+++ b/gcc9-libstdc++-compat.patch
@@ -9734,7 +9734,7 @@
 +#endif
 --- libstdc++-v3/src/nonshared17/cow-fs_path.cc.jj	2019-05-13 10:33:09.447939622 +0200
 +++ libstdc++-v3/src/nonshared17/cow-fs_path.cc	2019-05-14 18:43:03.283254489 +0200
-@@ -0,0 +1,72 @@
+@@ -0,0 +1,66 @@
 +// Copyright (C) 2019 Free Software Foundation, Inc.
 +//
 +// This file is part of the GNU ISO C++ Library.  This library is free
@@ -9774,9 +9774,6 @@
 +asm (".hidden _ZNSt10filesystem4path5_ListC2Ev");
 +asm (".hidden _ZNSt10filesystem4pathD1Ev");
 +asm (".hidden _ZNSt10filesystem4pathD2Ev");
-+asm (".hidden _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED0Ev");
-+asm (".hidden _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED1Ev");
-+asm (".hidden _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED2Ev");
 +asm (".hidden _ZNSt12__shared_ptrIKNSt10filesystem16filesystem_error5_ImplELN9__gnu_cxx12_Lock_policyE2EE4swapERS6_");
 +asm (".hidden _ZNSt12__shared_ptrIKNSt10filesystem16filesystem_error5_ImplELN9__gnu_cxx12_Lock_policyE2EE5resetEv");
 +asm (".hidden _ZNSt12__shared_ptrIKNSt10filesystem16filesystem_error5_ImplELN9__gnu_cxx12_Lock_policyE2EEaSEOS6_");
@@ -9795,16 +9792,13 @@
 +asm (".hidden _ZNSt23_Sp_counted_ptr_inplaceINSt10filesystem16filesystem_error5_ImplESaIS2_ELN9__gnu_cxx12_Lock_policyE2EED1Ev");
 +asm (".hidden _ZNSt23_Sp_counted_ptr_inplaceINSt10filesystem16filesystem_error5_ImplESaIS2_ELN9__gnu_cxx12_Lock_policyE2EED2Ev");
 +asm (".hidden _ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE");
-+asm (".hidden _ZTISt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE");
 +asm (".hidden _ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZTISt23_Sp_counted_ptr_inplaceINSt10filesystem16filesystem_error5_ImplESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZTSNSt10filesystem16filesystem_errorE");
 +asm (".hidden _ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE");
-+asm (".hidden _ZTSSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE");
 +asm (".hidden _ZTSSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZTSSt19_Sp_make_shared_tag");
 +asm (".hidden _ZTSSt23_Sp_counted_ptr_inplaceINSt10filesystem16filesystem_error5_ImplESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE");
-+asm (".hidden _ZTVSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE");
 +asm (".hidden _ZTVSt23_Sp_counted_ptr_inplaceINSt10filesystem16filesystem_error5_ImplESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag");
 --- libstdc++-v3/src/nonshared17/memory_resource.cc.jj	2019-05-13 10:33:09.463939355 +0200
@@ -10226,7 +10220,7 @@
 +	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
 --- libstdc++-v3/src/nonshared17/fs_path.cc.jj	2019-05-13 10:33:09.459939422 +0200
 +++ libstdc++-v3/src/nonshared17/fs_path.cc	2019-05-14 19:07:12.668093480 +0200
-@@ -0,0 +1,79 @@
+@@ -0,0 +1,73 @@
 +// Copyright (C) 2019 Free Software Foundation, Inc.
 +//
 +// This file is part of the GNU ISO C++ Library.  This library is free
@@ -10266,9 +10260,6 @@
 +asm (".hidden _ZNSt10filesystem7__cxx114path5_ListC2Ev");
 +asm (".hidden _ZNSt10filesystem7__cxx114pathD1Ev");
 +asm (".hidden _ZNSt10filesystem7__cxx114pathD2Ev");
-+asm (".hidden _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED0Ev");
-+asm (".hidden _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED1Ev");
-+asm (".hidden _ZNSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EED2Ev");
 +asm (".hidden _ZNSt12__shared_ptrIKNSt10filesystem7__cxx1116filesystem_error5_ImplELN9__gnu_cxx12_Lock_policyE2EE4swapERS7_");
 +asm (".hidden _ZNSt12__shared_ptrIKNSt10filesystem7__cxx1116filesystem_error5_ImplELN9__gnu_cxx12_Lock_policyE2EE5resetEv");
 +asm (".hidden _ZNSt12__shared_ptrIKNSt10filesystem7__cxx1116filesystem_error5_ImplELN9__gnu_cxx12_Lock_policyE2EEaSEOS7_");
@@ -10294,16 +10285,13 @@
 +#endif
 +#endif
 +asm (".hidden _ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE");
-+asm (".hidden _ZTISt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE");
 +asm (".hidden _ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZTISt23_Sp_counted_ptr_inplaceINSt10filesystem7__cxx1116filesystem_error5_ImplESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZTSNSt10filesystem7__cxx1116filesystem_errorE");
 +asm (".hidden _ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE");
-+asm (".hidden _ZTSSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE");
 +asm (".hidden _ZTSSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZTSSt19_Sp_make_shared_tag");
 +asm (".hidden _ZTSSt23_Sp_counted_ptr_inplaceINSt10filesystem7__cxx1116filesystem_error5_ImplESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE");
-+asm (".hidden _ZTVSt12codecvt_utf8IwLm1114111ELSt12codecvt_mode0EE");
 +asm (".hidden _ZTVSt23_Sp_counted_ptr_inplaceINSt10filesystem7__cxx1116filesystem_error5_ImplESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE");
 +asm (".hidden _ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag");
 --- libstdc++-v3/src/nonshared17/cow-string-inst.cc.jj	2019-05-13 10:33:09.451939555 +0200

Comment 3 Marek Polacek 2020-07-13 16:24:20 UTC
Hi Kefu, can you help me understand how important this is?  I.e., is it blocking building a project, or just a toy example?  Would a fixed build in Brew be enough (if this is for internal purposes only), or would we need to issue an advisory for this?  Thanks.

Comment 4 Kefu Chai 2020-07-14 07:28:10 UTC
hi Marek, thanks for looking into this issue.

we are mainly working on the upstream, and our builder is using RHEL repos and is located out side of redhat network.

it's a little bit complicated situation. our project (Ceph), depends on an upstream C++ library named seastar, which started using C++17 in one of its recent changes and it requires  GCC-9. we do have couple options though:

1. stay with the older version of this library,
2. fork it and drop the C++17 bits

but both options have their cons. either we cannot benefit from the improvements introduced after that breaking commit, or we have to maintain our own fork.  as seastar is still under active development, we'd like to keep up with it if possible.

the reason we want to stick with RHEL8/CentOS8 is that we plan to redistribute our project using container images built with el8.

IIUC, DTS 9 is only available for el7. so in the long run, it'd be great if we can have a fix accessible from a public channel for el8.

thanks

Comment 5 Marek Polacek 2020-07-14 17:09:29 UTC
Hi,

(In reply to Kefu Chai from comment #4)
> hi Marek, thanks for looking into this issue.
> 
> we are mainly working on the upstream, and our builder is using RHEL repos
> and is located out side of redhat network.
> 
> it's a little bit complicated situation. our project (Ceph), depends on an
> upstream C++ library named seastar, which started using C++17 in one of its
> recent changes and it requires  GCC-9. we do have couple options though:
> 
> 1. stay with the older version of this library,
> 2. fork it and drop the C++17 bits

I agree, both of these options sound terrible, I don't want you to have to go down that path.

> but both options have their cons. either we cannot benefit from the
> improvements introduced after that breaking commit, or we have to maintain
> our own fork.  as seastar is still under active development, we'd like to
> keep up with it if possible.
> 
> the reason we want to stick with RHEL8/CentOS8 is that we plan to
> redistribute our project using container images built with el8.
> 
> IIUC, DTS 9 is only available for el7. so in the long run, it'd be great if
> we can have a fix accessible from a public channel for el8.

OK, thanks for the explanation.  You're right: DTS is for RHEL 7 only, RHEL 8 has GTS (GCC Toolset).

Sounds like we'll have to issue an advisory for this.  I'll start the process.

Comment 6 Marek Polacek 2020-07-16 14:40:26 UTC
Fixed:

# g++ -std=c++17 t.C
#

Comment 7 Marek Polacek 2020-07-16 14:42:58 UTC
Adjusting sub/component.

Comment 11 Alexandra Petlanová Hájková 2020-07-23 13:49:11 UTC
I verified compilation of the test.cc fails due to hidden symbol for gcc-toolset-9-gcc-9.2.1-2.2.el8 and the test.cc compiles without any issues for gcc-toolset-9-gcc-9.2.1-2.3.el8.

Comment 12 Kefu Chai 2020-07-24 01:54:28 UTC
Marek and Alexandra, thanks for fixing and verifying this issue and fix!

Comment 15 errata-xmlrpc 2020-11-04 04:14:36 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 (new packages: gcc-toolset-10-systemtap), 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-2020:4834