Bug 90361 - [9/10 Regression] Undefined symbols in libstdc++ when building with --with-default-libstdcxx-abi=gcc4-compatible
Summary: [9/10 Regression] Undefined symbols in libstdc++ when building with --with-de...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 9.1.0
: P3 normal
Target Milestone: 9.3
Assignee: Jonathan Wakely
URL:
Keywords: ABI
Depends on:
Blocks:
 
Reported: 2019-05-06 12:17 UTC by Viktor Ostashevskyi
Modified: 2019-08-13 19:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-05-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Viktor Ostashevskyi 2019-05-06 12:17:14 UTC
Hello,

When build gcc-9.1.0 with --with-default-libstdc xx-abi=gcc4-compatible resulting libstdc++.so.6.0.26 contains following undefined symbols:

                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::__sv_wrapper::__sv_wrapper(std::basic_string_view<char, std::char_traits<char> >)
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_to_string_view(std::basic_string_view<char, std::char_traits<char> >)
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::data()
                 U std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::__sv_wrapper, std::allocator<char> const&)
                 U std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::data()

As result even minimal 'int main() { return 0; }' C++ program can't be linked.
Comment 1 Richard Biener 2019-05-06 13:05:12 UTC
I can link correctly with -D_GLIBCXX_USE_CXX11_ABI=0 have yet to check a build with the gcc4 ABI as default.
Comment 2 Jonathan Wakely 2019-05-06 13:06:49 UTC
I haven't checked a build with that option for ages, so I can easily believe I've broken it. I'll take a look tomorrow.
Comment 3 Viktor Ostashevskyi 2019-05-06 15:05:10 UTC
(In reply to Jonathan Wakely from comment #2)
> I haven't checked a build with that option for ages, so I can easily believe
> I've broken it. I'll take a look tomorrow.

It worked well in GCC 8.2.0 at least.
Comment 4 Viktor Ostashevskyi 2019-05-07 10:43:43 UTC
Bisected to:

commit c6e37a9f5734bfe731b042993f77cb41b5a566c5
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Sun Jan 6 22:34:29 2019 +0000

    PR libstdc++/86756 add std::filesystem::path to libstdc++.so
    
    Move the C++17 std::filesystem::path definitions from the libstdc++fs.a
    archive to the main libstdc++ library. The path classes do not depend on
    any OS functions, so can be defined unconditionally on all targets
    (rather than depending on --enable-libstdcxx-filesystem-ts). The tests
    should pass on all targets too.  
 ...
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267615 138bc75d-0d04-0410-961f-82ee72b054a4
Comment 5 Viktor Ostashevskyi 2019-05-13 10:54:38 UTC
It would be nice at least document that for GCC 9.1.0 building with --with-default-libstdcxx-abi=gcc4-compatible is broken.

Possible workaround is to build with default parameters and change _GLIBCXX_USE_DUAL_ABI define to 1 in bits/c++config.h after 'make install'.
Comment 6 Viktor Ostashevskyi 2019-05-13 10:59:19 UTC
(In reply to Viktor Ostashevskyi from comment #5)
> It would be nice at least document that for GCC 9.1.0 building with
> --with-default-libstdcxx-abi=gcc4-compatible is broken.
> 
> Possible workaround is to build with default parameters and change
> _GLIBCXX_USE_DUAL_ABI define to 1 in bits/c++config.h after 'make install'.

s/_GLIBCXX_USE_DUAL_ABI define to 1/_GLIBCXX_USE_CXX11_ABI define to 0/
Comment 7 Jakub Jelinek 2019-08-12 08:56:22 UTC
GCC 9.2 has been released.
Comment 8 Jonathan Wakely 2019-08-12 16:41:59 UTC
Author: redi
Date: Mon Aug 12 16:41:27 2019
New Revision: 274314

URL: https://gcc.gnu.org/viewcvs?rev=274314&root=gcc&view=rev
Log:
PR libstdc++/90361 add missing macro definition

The src/c++17/string-inst.cc file needs to override the default string
ABI so that it still contains the expected symbols even when the library
is configured with --with-default-libstdcxx-abi=gcc4-compatible.

	PR libstdc++/90361
	* src/c++17/string-inst.cc: Use _GLIBCXX_USE_CXX11_ABI=1 by default.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/src/c++17/string-inst.cc
Comment 9 Jonathan Wakely 2019-08-13 13:15:17 UTC
Author: redi
Date: Tue Aug 13 13:14:45 2019
New Revision: 274379

URL: https://gcc.gnu.org/viewcvs?rev=274379&root=gcc&view=rev
Log:
PR libstdc++/90361 add missing macro definition

The src/c++17/string-inst.cc file needs to override the default string
ABI so that it still contains the expected symbols even when the library
is configured with --with-default-libstdcxx-abi=gcc4-compatible.

Backport from mainline
2019-08-12  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/90361
	* src/c++17/string-inst.cc: Use _GLIBCXX_USE_CXX11_ABI=1 by default.

Modified:
    branches/gcc-9-branch/libstdc++-v3/ChangeLog
    branches/gcc-9-branch/libstdc++-v3/src/c++17/string-inst.cc
Comment 10 Jonathan Wakely 2019-08-13 13:17:04 UTC
This is fixed now. I'll add something to the release notes about the status in the 9.1 and 9.2 releases.
Comment 11 Viktor Ostashevskyi 2019-08-13 15:21:50 UTC
Cool! Thanks a lot, sad that this doesn't make to 9.2.
Comment 12 Jonathan Wakely 2019-08-13 19:05:13 UTC
Yes, sorry I missed the deadline for 9.2.