the trunk (upcoming 2.43) fails to link an LTO enabled build, which succeeded to link with 2.42. The failure is architecture independent. first seen 20240618, still seen with 20240710. the original bug report is from https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/2070302 collecting all the object files for a reproducer ...
I can't reproduce it with GCC 14 and binutils master 20240713: $ /usr/bin/g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -pthread -g -Wall -fno-strict-aliasing -Wnon-virtual-dtor -Wextra -fPIC -Wno-mismatched-tags -Wno-psabi -flto -ffat-lto-objects -Wno-error=null-dereference -Wno-error=overloaded-virtual -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-pedantic -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -Wl,--as-needed -Wl,--no-undefined tests/miral/CMakeFiles/miral-test.dir/external_client.cpp.o tests/miral/CMakeFiles/miral-test.dir/runner.cpp.o tests/miral/CMakeFiles/miral-test.dir/wayland_extensions.cpp.o tests/miral/CMakeFiles/miral-test.dir/zone.cpp.o tests/miral/CMakeFiles/miral-test.dir/server_example_decoration.cpp.o tests/miral/CMakeFiles/miral-test.dir/org_kde_kwin_server_decoration.c.o tests/miral/CMakeFiles/miral-test.dir/server-decoration_wrapper.cpp.o -o bin/miral-test.bin tests/libmir-test-assist.a lib/libmiral.so.7 lib/libmirserver.so.60 /usr/lib64/libuuid.so src/platforms/common/server/libserver_platform_common.a lib/libmirplatform.so.28 lib/libmirwayland.so.5 lib/libmircommon.so.10 /usr/lib64/libboost_filesystem.so.1.83.0 /usr/lib64/libboost_atomic.so.1.83.0 -ldl /usr/lib64/libxkbcommon.so /usr/lib64/libboost_program_options.so.1.83.0 /usr/lib64/libepoxy.so lib/libmircore.so.2 /usr/lib64/libwayland-server.so src/platforms/common/server/kms-utils/libkms_utils.a /usr/lib64/libboost_iostreams.so.1.83.0 /usr/lib64/libdrm.so /usr/lib64/libEGL.so /usr/lib64/libGLESv2.so /usr/lib64/libudev.so /usr/lib64/libglib-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libxcb.so /usr/lib64/libxcb-composite.so /usr/lib64/libxcb-xfixes.so /usr/lib64/libxcb-randr.so /usr/lib64/libxcb-render.so /usr/lib64/libXcursor.so /usr/lib64/liblttng-ust.so /usr/lib64/liblttng-ust-common.so /usr/lib64/libdl.a /usr/lib64/libfreetype.so -latomic /usr/lib64/libboost_system.so.1.83.0 -lgtest -lgtest_main -lgmock -lgtest -lgtest_main -lgmock /usr/lib64/libwayland-client.so $
when building with 14, I get different issues: /usr/bin/ld: CMakeFiles/mir_unit_tests.dir/frontend_wayland/test_desktop_file_manager.cpp.o: in function `DesktopFileManager_can_resolve_from_valid_flatpak_info_Test::TestBody()':
I tried briefly with GCC trunk and it built OK here too. Could you link to or attach a full build log here while you're working on gathering it into something standalone?
still seen with the 2.43.1 releases with aarch64-linux-gnu and arm-linux-gnueabihf, object files for aarch64 are at https://people.debian.org/~doko/tmp/pr31982.tar.xz
fails with /usr/bin/ld: /tmp/ccijjp3k.ltrans5.ltrans.o: in function `StaticDisplayConfig_nonexistent_config_file_is_no_error_Test::TestBody()': /usr/src/mir-2.14.1-7/tests/miral/static_display_config.cpp:154:(.text+0x6d94): warning: the use of `tmpnam' is dangerous, better use `mkstemp' /usr/bin/ld: ../libmir-test-assist.a(mmap_wrapper.cpp.o): in function `std::literals::string_literals::operator"" s[abi:cxx11](char const*, unsigned long)': /usr/include/c++/14/bits/basic_string.h:4694:(.text+0x6f8): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)' /usr/bin/ld: /usr/include/c++/14/bits/basic_string.h:4694:(.text+0xa64): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)' collect2: error: ld returned 1 exit status
(In reply to Matthias Klose from comment #5) > fails with > > /usr/bin/ld: /tmp/ccijjp3k.ltrans5.ltrans.o: in function > `StaticDisplayConfig_nonexistent_config_file_is_no_error_Test::TestBody()': > /usr/src/mir-2.14.1-7/tests/miral/static_display_config.cpp:154:(. > text+0x6d94): warning: the use of `tmpnam' is dangerous, better use `mkstemp' > /usr/bin/ld: ../libmir-test-assist.a(mmap_wrapper.cpp.o): in function > `std::literals::string_literals::operator"" s[abi:cxx11](char const*, > unsigned long)': > /usr/include/c++/14/bits/basic_string.h:4694:(.text+0x6f8): undefined > reference to `std::__cxx11::basic_string<char, std::char_traits<char>, > std::allocator<char> >::basic_string(char const*, unsigned long, > std::allocator<char> const&)' > /usr/bin/ld: /usr/include/c++/14/bits/basic_string.h:4694:(.text+0xa64): > undefined reference to `std::__cxx11::basic_string<char, > std::char_traits<char>, std::allocator<char> >::basic_string(char const*, > unsigned long, std::allocator<char> const&)' > collect2: error: ld returned 1 exit status On Fedora 40/x86-64, I got [hjl@gnu-cfl-3 lib64]$ readelf --dyn-syms -W /usr/lib64/libstdc++.so.6.0.33 | grep 00000000000c1a20 1727: 00000000000c1a20 42 FUNC WEAK DEFAULT 4 _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2EPKcmRKS3_@@GLIBCXX_3.4.21 4081: 00000000000c1a20 42 FUNC WEAK DEFAULT 4 _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EPKcmRKS3_@@GLIBCXX_3.4.21 [hjl@gnu-cfl-3 lib64]$ readelf --dyn-syms -W /usr/lib64/libstdc++.so.6.0.33 | grep 00000000000c1a20 | c++filt 1727: 00000000000c1a20 42 FUNC WEAK DEFAULT 4 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)@@GLIBCXX_3.4.21 4081: 00000000000c1a20 42 FUNC WEAK DEFAULT 4 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)@@GLIBCXX_3.4.21 [hjl@gnu-cfl-3 lib64]$ What do you get?
$ readelf --dyn-syms -W /lib/aarch64-linux-gnu/libstdc++.so.6.0.33 | grep _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC.EPKcmRKS3_ 1741: 0000000000167380 60 FUNC WEAK DEFAULT 13 _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2EPKcmRKS3_@@GLIBCXX_3.4.21 4088: 0000000000167380 60 FUNC WEAK DEFAULT 13 _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EPKcmRKS3_@@GLIBCXX_3.4.21 $ readelf --dyn-syms -W /lib/aarch64-linux-gnu/libstdc++.so.6.0.33 | grep _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC.EPKcmRKS3_|c++filt 1741: 0000000000167380 60 FUNC WEAK DEFAULT 13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)@@GLIBCXX_3.4.21 4088: 0000000000167380 60 FUNC WEAK DEFAULT 13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)@@GLIBCXX_3.4.21
(In reply to Matthias Klose from comment #5) > fails with > > /usr/bin/ld: /tmp/ccijjp3k.ltrans5.ltrans.o: in function > `StaticDisplayConfig_nonexistent_config_file_is_no_error_Test::TestBody()': > /usr/src/mir-2.14.1-7/tests/miral/static_display_config.cpp:154:(. > text+0x6d94): warning: the use of `tmpnam' is dangerous, better use `mkstemp' > /usr/bin/ld: ../libmir-test-assist.a(mmap_wrapper.cpp.o): in function > `std::literals::string_literals::operator"" s[abi:cxx11](char const*, > unsigned long)': > /usr/include/c++/14/bits/basic_string.h:4694:(.text+0x6f8): undefined > reference to `std::__cxx11::basic_string<char, std::char_traits<char>, > std::allocator<char> >::basic_string(char const*, unsigned long, > std::allocator<char> const&)' > /usr/bin/ld: /usr/include/c++/14/bits/basic_string.h:4694:(.text+0xa64): > undefined reference to `std::__cxx11::basic_string<char, > std::char_traits<char>, std::allocator<char> >::basic_string(char const*, > unsigned long, std::allocator<char> const&)' > collect2: error: ld returned 1 exit status I can't reproduce it on Fedora 40/x86-64. It may have something to do with how your GCC is configured and the command-line options passed to linker. Please show the output of # gcc -v as well as pass -v to the final link command and show the full linker command line.
Created attachment 15688 [details] log of the build
$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-linux-gnu/14/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 14.2.0-3ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-14/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr --with-gcc-major-version-only --program-suffix=-14 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-offload-targets=nvptx-none=/build/gcc-14-3heZVg/gcc-14-14.2.0/debian/tmp-nvptx/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.2.0 (Ubuntu 14.2.0-3ubuntu1)
(In reply to Matthias Klose from comment #9) > Created attachment 15688 [details] > log of the build Does it fail on x86-64?
sorry, I didn't mention the architectures. It fails on aarch64-linux-gnu, arm-linux-gnueabihf, arm-linux-gnueabi, alpha-linux-gnu, powerpc-linux-gnu and sparc64-linux-gnu. Other architectures work ok, see https://buildd.debian.org/status/package.php?p=mir
(In reply to Matthias Klose from comment #12) > sorry, I didn't mention the architectures. It fails on aarch64-linux-gnu, > arm-linux-gnueabihf, arm-linux-gnueabi, alpha-linux-gnu, powerpc-linux-gnu > and sparc64-linux-gnu. Other architectures work ok, see > https://buildd.debian.org/status/package.php?p=mir Can you bisect which commit caused this? Some bugs may be only fixed on x86. If you have a self-contained test for aarch64-linux-gnu cross compiler, I can take a look.