https://sourceware.org/bugzilla/show_bug.cgi?id=25589
Bug ID: 25589 Summary: LTO parallel build fails with "/usr/bin/ld: cannot find <foo>.lto.o: No such file or directory" Product: binutils Version: 2.34 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: kloczko.tomasz at gmail dot com Target Milestone: --- Few weeks ago when I've started experimenting with LTO I've started noticing that sometimes ld fails because it cannot find some <foo>.lto.o. I'm using everywhere -pipe option so theoretically no such file should be stored. One of the examples where ld fails is glib2. When everything is build with -j1 everything is fine and nothing fails Here is example which fails: [999/1185] gcc -o gobject/tests/properties 'gobject/tests/36a2d80@@properties@exe/properties.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronou s-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto= auto -flto-partition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,--end-group -pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/..' -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/gobject FAILED: gobject/tests/properties gcc -o gobject/tests/properties 'gobject/tests/36a2d80@@properties@exe/properties.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLI BCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-ta bles -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto- partition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,--end-group -pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/..' -Wl,-rpath- link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/gobject /usr/bin/ld: cannot find properties.lto.o: No such file or directory collect2: error: ld returned 1 exit status [1000/1185] gcc -o tests/gobject/performance 'tests/gobject/60338e1@@performance@exe/performance.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOUR CE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchr onous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -f lto=auto -flto-partition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,--end-group -pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/ ../../gobject' -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/gobject [1001/1185] gcc -o gobject/tests/boxed 'gobject/tests/36a2d80@@boxed@exe/boxed.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCX X_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-table s -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-par tition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,--end-group -pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/..' -Wl,-rpath-lin k,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/gobject [1002/1185] gcc -o gobject/tests/binding 'gobject/tests/36a2d80@@binding@exe/binding.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_ GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind -tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -fl to-partition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,--end-group -pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/..' -Wl,-rpa th-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/gobject [1003/1185] gcc -o gobject/tests/reference 'gobject/tests/36a2d80@@reference@exe/reference.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 - Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous- unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=au to -flto-partition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,--end-group -pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/..' -W l,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/gobject [1004/1185] gcc -o gobject/tests/signals 'gobject/tests/36a2d80@@signals@exe/meson-generated_.._marshalers.c.o' 'gobject/tests/36a2d80@@signals@exe/signals.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/ rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,- -end-group -pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/..' -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib -2.63.5/x86_64-redhat-linux-gnu/gobject FAILED: gobject/tests/signals gcc -o gobject/tests/signals 'gobject/tests/36a2d80@@signals@exe/meson-generated_.._marshalers.c.o' 'gobject/tests/36a2d80@@signals@exe/signals.c.o' -Wl,--as-needed -Wl,--no-undefined -O2 -g -pipe -W all -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/r edhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -DG_DISABLE_ASSERT -Wl,-z,relro -Wl,--as-needed -Wl,-z,now - specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--start-group glib/libglib-2.0.so.0.6305.0 gobject/libgobject-2.0.so.0.6305.0 -lm -Wl,--end-group - pthread '-Wl,-rpath,$ORIGIN/../../glib:$ORIGIN/..' -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_64-redhat-linux-gnu/glib -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/glib-2.63.5/x86_ 64-redhat-linux-gnu/gobject /usr/bin/ld: cannot find signals.lto.o: No such file or directory collect2: error: ld returned 1 exit status Here is set of flags which I'm using on buildig my packages with LTO: $ rpm -E %set_build_flags export CFLAGS="${CFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none}"; export CXXFLAGS="${CXXFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none}"; export FFLAGS="${FFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -flto=auto -flto-partition=none}"; export FCFLAGS="${FCFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules -flto=auto -flto-partition=none}"; export LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin}"; export AR="/usr/bin/gcc-ar" RANLIB="/usr/bin/gcc-ranlib" NM="/usr/bin/gcc-nm"; export CC="gcc" CXX="g++" glib uses meson bug I found as well some cmake examples like evolution and ac/am/lt based so this points that it must be something released to the linker or interaction between gcc and ld when LTO is used. https://gitlab.gnome.org/GNOME/glib/issues/1905 Again everything is fine as long as LTO is not used or when LTO is used I'm building packages without palatalisation (-j1) -- You are receiving this mail because: You are on the CC list for the bug.