This symbol, with correct version, is defined in libstdc++.so.6:
objdump -T -C /lib/x86_64-linux-gnu/libstdc++.so.6 | rg "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create"
0000000000146910 w DF .text 000000000000005c GLIBCXX_3.4.21 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)
Adding -fuse-ld=gold or -fuse-ld=lld to the command line results in a successful link.
It doesn't seem to be a problem of the /usr/bin/c++ driver failing to add libstdc++ to the link args, as manually adding -lstdc++ to the end of the command doesn't change the output.
Ok. This would appear to be a ld bug. In a partially built tree, I get:
> /usr/bin/c++ -g -O2 -ffile- prefix- map=/home/ chris/Canonical /Mir/mir/ main/cmake- build-debug= . -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack- protector- strong -Wformat -Werror= format- security -pthread -g -Wall -fno-strict- aliasing -pedantic -Wnon-virtual-dtor -Wextra -fPIC -Werror -Wno-mismatched -tags -Wno-psabi -g -Wl,-Bsymbolic- functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,--as-needed -Wl,--no-undefined examples/ miral-system- compositor/ CMakeFiles/ miral-system- compositor. dir/system_ compositor_ main.cpp. o -o bin/miral- system- compositor. bin lib/libmiral.so.4 lib/libmircommo n.so.8 lib/libmircooki e.so.2 -lnettle /usr/lib/ x86_64- linux-gnu/ libboost_ date_time. so.1.74. 0 /usr/lib/ x86_64- linux-gnu/ libboost_ program_ options. so.1.74. 0 /usr/lib/ x86_64- linux-gnu/ libboost_ filesystem. so.1.74. 0 /usr/lib/ x86_64- linux-gnu/ libboost_ iostreams. so.1.74. 0 -ldl /usr/lib/ x86_64- linux-gnu/ libxkbcommon. so lib/libmircore.so.1 /usr/lib/ x86_64- linux-gnu/ libboost_ system. so.1.74. 0 -L/usr/ lib/x86_ 64-linux- gnu -Wl,-rpath- link,/home/ chris/Canonical /Mir/mir/ main/cmake- build-debug/ lib 64-linux- gnu/libyaml- cpp.so. 0.7: undefined reference to `std::_ _cxx11: :basic_ string< char, std::char_ traits< char>, std::allocator< char> >::_M_create( unsigned long&, unsigned long)@GLIBCXX_ 3.4.21'
/usr/bin/ld: /lib/x86_
collect2: error: ld returned 1 exit status
This symbol, with correct version, is defined in libstdc++.so.6: 64-linux- gnu/libstdc+ +.so.6 | rg "std::_ _cxx11: :basic_ string< char, std::char_ traits< char>, std::allocator< char> >::_M_create" cxx11:: basic_string< char, std::char_ traits< char>, std::allocator< char> >::_M_create( unsigned long&, unsigned long)
objdump -T -C /lib/x86_
0000000000146910 w DF .text 000000000000005c GLIBCXX_3.4.21 std::__
Adding -fuse-ld=gold or -fuse-ld=lld to the command line results in a successful link.
It doesn't seem to be a problem of the /usr/bin/c++ driver failing to add libstdc++ to the link args, as manually adding -lstdc++ to the end of the command doesn't change the output.