Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915402 - gui-libs/gtk-4.12.2 fails to build on a hardened musl LLVM profile on ~amd64.
Summary: gui-libs/gtk-4.12.2 fails to build on a hardened musl LLVM profile on ~amd64.
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-09 00:52 UTC by ezntek
Modified: 2024-01-09 19:24 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
The complete build log at /var/tmp/portage/gui-libs/gtk-4.12.2/temp/build.log (build.log,431.79 KB, text/x-log)
2023-10-09 00:52 UTC, ezntek
Details
emerge --info (emerge-info.txt,17.17 KB, text/plain)
2023-10-09 00:53 UTC, ezntek
Details
build.log with -O2 and -march=native only (build.log,405.40 KB, text/x-log)
2023-10-09 00:59 UTC, ezntek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ezntek 2023-10-09 00:52:54 UTC
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.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-09 00:53:46 UTC
Can you give a log of it happening with just -O2?
Comment 2 ezntek 2023-10-09 00:53:48 UTC
Created attachment 872366 [details]
emerge --info

emerge --info
Comment 3 ezntek 2023-10-09 00:57:06 UTC
(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"
```
Comment 4 ezntek 2023-10-09 00:59:29 UTC
Created attachment 872367 [details]
build.log with -O2 and -march=native only
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-09 01:22:26 UTC
(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.
Comment 6 Sv. Lockal 2024-01-06 17:40:50 UTC
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).
Comment 7 Mart Raudsepp gentoo-dev 2024-01-06 17:56:53 UTC
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
Comment 8 Sv. Lockal 2024-01-09 19:24:51 UTC
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.