Created attachment 872365 [details] The complete build log at /var/tmp/portage/gui-libs/gtk-4.12.2/temp/build.log When trying to emerge `=dev-libs/gtk-4.12.2` with Clang 17 and 16 with various flags (flto=thin, polly, etc.) on and off, the build always fails on an objcopy step: ``` [342/1013] /usr/bin/msgfmt -o po/hu/LC_MESSAGES/gtk40.mo ../gtk-4.12.2/po/hu.po [343/1013] /usr/lib/llvm/17/bin/llvm-objcopy --strip-all --rename-section .data=.gresource.gtk --add-symbol _gtk_resource_data=.gresource.gtk:0 gtk/gtkresources_blob.o gtk/gtkresources_blob2.o FAILED: gtk/gtkresources_blob2.o /usr/lib/llvm/17/bin/llvm-objcopy --strip-all --rename-section .data=.gresource.gtk --add-symbol _gtk_resource_data=.gresource.gtk:0 gtk/gtkresources_blob.o gtk/gtkresources_blob2.o /usr/lib/llvm/17/bin/llvm-objcopy: error: 'gtk/gtkresources_blob.o': Symbol table has link index of 5 which is not a valid index [344/1013] /usr/bin/msgfmt -o po/hy/LC_MESSAGES/gtk40.mo ../gtk-4.12.2/po/hy.po ``` this one was built with clang-16, with only -O2 and -march=native turned on, however when building with polly, thinLTO and clang-17, it still fails on the same error.
Can you give a log of it happening with just -O2?
Created attachment 872366 [details] emerge --info emerge --info
(In reply to Sam James from comment #1) > Can you give a log of it happening with just -O2 The build log attatched is with me building it with -O2. emerge --info doesn't show the settings I applied through /etc/portage/env. Contents of my env file: ``` CC="clang-16" CXX="clang++-16" CPP="clang-cpp-16" AR="/usr/lib/llvm/16/bin/llvm-ar" NM="/usr/lib/llvm/16/bin/llvm-nm" RANLIB="/usr/lib/llvm/16/bin/llvm-ranlib" OBJCOPY="/usr/lib/llvm/16/bin/llvm-objcopy" COMMON_FLAGS="-O2 -march=native" CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${COMMON_FLAGS}" LDFLAGS="-Wl,--as-needed" ```
Created attachment 872367 [details] build.log with -O2 and -march=native only
(In reply to ezntek from comment #3) > (In reply to Sam James from comment #1) > > Can you give a log of it happening with just -O2 > > The build log attatched is with me building it with -O2. emerge --info > doesn't show the settings I applied through /etc/portage/env. > The log at https://bugs.gentoo.org/915402#c0 had LTO and Polly still. The latest one is fine, thanks.
Same error occurs with this setup: amd64 + glibc + clang 17.0.6 + all llvm binutils replacements (https://llvm.org/docs/CommandGuide/index.html#gnu-binutils-replacements) Upstream report: https://gitlab.gnome.org/GNOME/gtk/-/issues/6047 In the link above, Matthias Clasen mentioned that "That is fixed in main", however latest =gui-libs/gtk/gtk-4.12.4.ebuild did not solve the issue for me. Manually setting OBJCOPY="objcopy" in env helped (for my setup).
Pretty sure the references things in main are included in 4.12.4 already, so might need even more checks upstream. Can you try `main`? E.g. clone the repo and just run it with default options while passing in the relevant CC and co via env vars or something
I reproduced the issue in `main` and added logs to https://gitlab.gnome.org/GNOME/gtk/-/issues/6047 . I don't know how they check whether objcopy is good, but when defined in meson.x86_64-pc-linux-gnu.amd64.ini (as objcopy = ['llvm-objcopy']), build still fails.