Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 908078

Summary: gui-libs/gtk-4.10.4 fails to compile on ~amd64 llvm profile ld.lld: error: target emulation unknown: -m or at least one .o file required
Product: Gentoo Linux Reporter: Denis Strizhkin <strdenis02>
Component: Current packagesAssignee: Gentoo Linux Gnome Desktop Team <gnome>
Status: CONFIRMED ---    
Severity: major CC: darwinskernel, gentoo.bugs, gentoo.qxrin, leio, thymelizabeth, unhappy-ending, vimproved, w12101111
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also: https://gitlab.gnome.org/GNOME/gtk/-/issues/5672
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6156
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3186
https://github.com/gentoo/gentoo/pull/32204
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 920660    
Bug Blocks: 408963    
Attachments: build.log
build.log (amd64, 4.10.4)
gtk-4.10.4 build error
build system ignores -fuse-ld

Description Denis Strizhkin 2023-06-08 20:18:27 UTC
[308/946] /usr/lib/llvm/16/bin/ld.lld -z noexecstack -r -b binary gtk/gtk.gresource -o gtk/gtkresources_blob.o
FAILED: gtk/gtkresources_blob.o 
/usr/lib/llvm/16/bin/ld.lld -z noexecstack -r -b binary gtk/gtk.gresource -o gtk/gtkresources_blob.o
ld.lld: error: target emulation unknown: -m or at least one .o file required

Reproducible: Always

Steps to Reproduce:
1. llvm profile
2. enable ~amd64 globally
3. emerge gui-libs/gtk



emerge --info:
Portage 3.0.48.1 (python 3.11.3-final-0, default/linux/amd64/23.0/llvm, gcc-13, glibc-2.37-r3, 6.1.27-gentoo-r1 x86_64)
=================================================================
System uname: Linux-6.1.27-gentoo-r1-x86_64-AMD_Ryzen_5_5600X_6-Core_Processor-with-glibc2.37
KiB Mem:    32741484 total,   9560152 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 06 Jun 2023 19:00:01 +0000
Head commit of repository gentoo: f9513ea54b79b855cada6ca26f963b192dd3d333
Timestamp of repository guru: Wed, 07 Jun 2023 09:17:09 +0000
Head commit of repository guru: 8304bd0ff78c34a9638d53a32e97feded91fb49b

sh bash 5.2_p15-r3
ld GNU ld (Gentoo 2.40 p5) 2.40.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r3::gentoo
dev-java/java-config:      2.3.1-r1::gentoo
dev-lang/perl:             5.36.1-r2::gentoo
dev-lang/python:           3.11.3::gentoo, 3.12.0_beta1_p4::gentoo
dev-lang/rust:             1.69.0-r1::gentoo
dev-util/cmake:            3.26.4-r1::gentoo
dev-util/meson:            1.1.1::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/openrc:           0.47.1::gentoo
sys-apps/sandbox:          2.30-r1::gentoo
sys-devel/autoconf:        2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.5::gentoo
sys-devel/gcc:             13.1.1_p20230527::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.5::gentoo
sys-devel/llvm:            16.0.5::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://188.134.69.12/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

gentoo-local-denis
    location: /var/db/repos/gentoo-local-denis
    masters: gentoo
    volatile: False

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: False

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
ADDR2LINE="llvm-addr2line"
AR="llvm-ar"
AS="clang -c"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-march=znver1 -O3 -pipe -flto"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CPP="clang-cpp"
CXX="clang++"
CXXFLAGS="-march=znver1 -O3 -pipe -flto"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs 12 --load-average 13"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=znver1 -O3 -pipe -flto"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=znver1 -O3 -pipe -flto"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LD="ld.lld"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed "
LEX="flex"
LINGUAS="en"
MAKEOPTS="--jobs 12 --load-average 13"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RANLIB="llvm-ranlib"
READELF="llvm-readelf"
SHELL="/bin/bash"
STRINGS="llvm-strings"
STRIP="llvm-strip"
USE="acl amd64 clang crypt elogind gdbm libtirpc llvm-libunwind man ncurses nptl pam pcre pulseaudio readline seccomp ssl unicode vulkan wayland xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-4" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby30 ruby31" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS, SIZE, YACC, YFLAG
Comment 1 Denis Strizhkin 2023-06-08 20:22:20 UTC
Created attachment 863587 [details]
build.log
Comment 2 ernsteiswuerfel archtester 2023-07-03 10:52:36 UTC
Created attachment 865090 [details]
build.log (amd64, 4.10.4)

Same here on amd64 musl/clang.
Comment 3 ernsteiswuerfel archtester 2023-07-03 10:55:19 UTC
Does not seem to be a clang-16 issue, happens with clang-15 too on my machine.
Comment 4 Alex Pushkin 2023-07-03 18:01:42 UTC
The same with my machine:

gtk-4.10.4, but gtk-4.10.3 emerged without any bugs.

[329/908] /usr/bin/msgfmt ../gtk-4.10.4/po/zh_HK.po -o po/zh_HK/LC_MESSAGES/gtk40.mo
[330/908] /usr/bin/msgfmt ../gtk-4.10.4/po/zh_TW.po -o po/zh_TW/LC_MESSAGES/gtk40.mo
[331/908] /usr/bin/glib-compile-resources --generate-header --internal --target=gtk/gtkresources.h --dependency-file=gtk/gtkresources.h.d --sourcedir=/var/tmp/portage/gui-libs/gtk-4.10.4/work/gtk-4.10.4/gtk --sourcedir=/var/tmp/portage/gui-libs/gtk-4.10.4/work/gtk-4.10.4-build/gtk --external-data --c-name _gtk --manual-register gtk/gtk.gresources.xml
[332/908] /usr/bin/glib-compile-resources --generate --internal --target=gtk/gtk.gresource --dependency-file=gtk/gtk.gresource.d --sourcedir=/var/tmp/portage/gui-libs/gtk-4.10.4/work/gtk-4.10.4/gtk --sourcedir=/var/tmp/portage/gui-libs/gtk-4.10.4/work/gtk-4.10.4-build/gtk gtk/gtk.gresources.xml
[333/908] /usr/lib/llvm/16/bin/ld.lld -z noexecstack -r -b binary gtk/gtk.gresource -o gtk/gtkresources_blob.o
FAILED: gtk/gtkresources_blob.o
/usr/lib/llvm/16/bin/ld.lld -z noexecstack -r -b binary gtk/gtk.gresource -o gtk/gtkresources_blob.o
ld.lld: error: target emulation unknown: -m or at least one .o file required
[334/908] /usr/bin/glib-compile-resources --generate-source --internal --target=gtk/gtkresources.c --dependency-file=gtk/gtkresources.c.d --sourcedir=/var/tmp/portage/gui-libs/gtk-4.10.4/work/gtk-4.10.4/gtk --sourcedir=/var/tmp/portage/gui-libs/gtk-4.10.4/work/gtk-4.10.4-build/gtk --external-data --c-name _gtk --manual-register gtk/gtk.gresources.xml
[335/908] /usr/lib/python-exec/python3.11/meson --internal exe --capture docs/reference/gtk/gtk4-builder-tool.1 -- /usr/bin/rst2man.py --syntax-highlight=none ../gtk-4.10.4/docs/reference/gtk/gtk4-builder-tool.rst
[336/908] /usr/lib/python-exec/python3.11/meson --internal exe --capture docs/reference/gtk/gtk4-broadwayd.1 -- /usr/bin/rst2man.py --syntax-highlight=none ../gtk-4.10.4/docs/reference/gtk/gtk4-broadwayd.rst


emerge --info
Portage 3.0.46 (python 3.11.4-final-0, default/linux/amd64/17.1/clang, gcc-12, glibc-2.37-r3, 6.1.31-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-6.1.31-gentoo-x86_64-x86_64-AMD_Ryzen_7_5800X3D_8-Core_Processor-with-glibc2.37
KiB Mem:    32779908 total,  26117828 free
KiB Swap:   31998972 total,  31998972 free
Timestamp of repository gentoo: Mon, 03 Jul 2023 15:00:01 +0000
Head commit of repository gentoo: 2a0dca499f38a1f9f6f16076231376dbb1be64aa
sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.40 p5) 2.40.0
ccache version 4.8.2 [disabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-lang/perl:             5.36.1-r2::gentoo
dev-lang/python:           3.11.4::gentoo
dev-lang/rust:             1.70.0::gentoo
dev-util/ccache:           4.8.2::gentoo
dev-util/cmake:            3.26.4-r1::gentoo
dev-util/meson:            1.1.1::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/openrc:           0.46::gentoo
sys-apps/sandbox:          2.32::gentoo
sys-devel/autoconf:        2.13-r7::gentoo, 2.71-r6::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r5::gentoo, 2.40-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.5::gentoo
sys-devel/gcc:             12.3.1_p20230526::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.5::gentoo
sys-devel/llvm:            16.0.5::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts:

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
ADDR2LINE="llvm-addr2line"
AR="llvm-ar"
AS="clang -c"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CPP="clang-cpp"
CXX="clang++"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y --complete-graph y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live candy config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://mirrors.tuna.tsinghua.edu.cn/gentoo     https://ftp.jaist.ac.jp/pub/Linux/Gentoo/     https://ftp.riken.jp/Linux/gentoo/     https://mirror.ps.kz/gentoo/pub     https://mirror.yandex.ru/gentoo-distfiles/"
LANG="C.UTF8"
LD="ld.lld"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed "
LEX="flex"
MAKEOPTS="-j16"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BINHOST="https://ftp.jaist.ac.jp/pub/Linux/Gentoo/experimental/amd64/binpkg/default/linux/17.1/x86-64/"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RANLIB="llvm-ranlib"
READELF="llvm-readelf"
SHELL="/bin/bash"
STRINGS="llvm-strings"
STRIP="llvm-strip"
USE="10bit 8bit acl amd64 bzip2 clang cli cpudetection crypt dbus dri elogind firmware fortran gdbm h264 iconv ipv6 libtirpc libvirt libvirtd llvm-libunwind multilib ncurses nls nptl opengl openh264 openmp pam pcre pipewire readline seccomp split-usr ssl test-rust truetype unicode vdpau verify-sig vulkan xattr zfs zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput synaptics" KERNEL="linux" L10N="en-GB ja zh-CN zh-TW" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="amdgpu radeonsi virgl nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS, SIZE, YACC, YFLAGS
Comment 5 Alex Pushkin 2023-07-03 18:03:33 UTC
Created attachment 865108 [details]
gtk-4.10.4 build error
Comment 6 unhappy-ending 2023-07-06 17:07:06 UTC
I can confirm the same error. However, this doesn't happen in gtk-4.10.3, which compiles fine. Something changed on the point release to cause this.
Comment 7 unhappy-ending 2023-07-06 17:16:56 UTC
I tried to use -fuse-ld=bfd to see if I got the same error and for some reason the build system is completely ignoring it and I'm still getting ld.lld: error: target emulation unknown: -m or at least one .o file required. Not sure what's going on with that, but that shouldn't happen.
Comment 8 unhappy-ending 2023-07-06 17:20:56 UTC
Created attachment 865212 [details]
build system ignores -fuse-ld

See build flags contain -fuse-ld=bfd, but still gets ld.lld error.
Comment 9 Chris 2023-07-07 16:29:55 UTC
Interestingly I also added the gui-libs/gtk build to my GCC override profile (I'm on LLVM) in an attempt to work around the problem, and I run into the same issue - even with the environment settings forcing GCC toolkit, the ebuild seems to ignore it and forces a build against LLVM.
Comment 10 unhappy-ending 2023-07-07 21:02:08 UTC
(In reply to Chris from comment #9)
> Interestingly I also added the gui-libs/gtk build to my GCC override profile
> (I'm on LLVM) in an attempt to work around the problem, and I run into the
> same issue - even with the environment settings forcing GCC toolkit, the
> ebuild seems to ignore it and forces a build against LLVM.

What happens when you use GCC but pass -fuse-ld=lld to your LDFLAGS?
Comment 11 Chris 2023-07-10 19:58:01 UTC
(In reply to unhappy-ending from comment #10)
> (In reply to Chris from comment #9)
> > Interestingly I also added the gui-libs/gtk build to my GCC override profile
> > (I'm on LLVM) in an attempt to work around the problem, and I run into the
> > same issue - even with the environment settings forcing GCC toolkit, the
> > ebuild seems to ignore it and forces a build against LLVM.
> 
> What happens when you use GCC but pass -fuse-ld=lld to your LDFLAGS?

Sadly it's the same behavior. 

Here's the env file that I was pointing my compiler override at...

CC="gcc"
CXX="g++"

AR="${CHOST}-ar"
NM="${CHOST}-nm"
RANLIB="${CHOST}-ranlib"

COMMON_FLAGS="-O3 -march=native"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
LDFLAGS="-Wl,--as-needed -fuse-ld=lld"
Comment 12 unhappy-ending 2023-07-11 06:26:32 UTC
(In reply to Chris from comment #11)
> (In reply to unhappy-ending from comment #10)
> > (In reply to Chris from comment #9)
> > > Interestingly I also added the gui-libs/gtk build to my GCC override profile
> > > (I'm on LLVM) in an attempt to work around the problem, and I run into the
> > > same issue - even with the environment settings forcing GCC toolkit, the
> > > ebuild seems to ignore it and forces a build against LLVM.
> > 
> > What happens when you use GCC but pass -fuse-ld=lld to your LDFLAGS?
> 
> Sadly it's the same behavior. 
> 
> Here's the env file that I was pointing my compiler override at...
> 
> CC="gcc"
> CXX="g++"
> 
> AR="${CHOST}-ar"
> NM="${CHOST}-nm"
> RANLIB="${CHOST}-ranlib"
> 
> COMMON_FLAGS="-O3 -march=native"
> CFLAGS="${COMMON_FLAGS}"
> CXXFLAGS="${COMMON_FLAGS}"
> LDFLAGS="-Wl,--as-needed -fuse-ld=lld"

Same issue for me. Funny, 4.11.4 compiles just fine :( Must be something in the 4.10.4 build system. 

For a quick test I unmerged lld from my system and then used -fuse-ld=bfd and it compiled without a problem. Really not sure what's going on. I'm just going to mask 4.10.4 since the next release doesn't have the issue.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-11 06:30:23 UTC
That's not unexpected at all, as it got fixed upstream in 4.11.x.
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-22 14:12:01 UTC
(In reply to Sam James from comment #13)
> That's not unexpected at all, as it got fixed upstream in 4.11.x.

Or, rather, it's workedaroundededed as it still needs Binutils.
Comment 15 Brahmajit Das 2023-07-22 14:21:08 UTC
Seems like it's fixed in gui-libs/gtk-4.11.4
Comment 16 immolo 2023-10-09 14:56:58 UTC
This came up as a support question in Discord today reported by who.

I've confirmed the issue now only exists on stable gentoo llvm systems as using gui-libs/gtk-4.12.5 will solve the solve the issue however a further test is required if the STABLEREQ will be enough to close this in Gentoo or if it's just a workaround needing binutils as Sam highlighted.

Steps to reproduce now are as follows:

1. Setup new llvm stage3
2. emerge -va gui-libs/gtk

Result:

[308/946] /usr/lib/llvm/16/bin/ld.lld -z noexecstack -r -b binary gtk/gtk.gresource -o gtk/gtkresources_blob.o
FAILED: gtk/gtkresources_blob.o 
/usr/lib/llvm/16/bin/ld.lld -z noexecstack -r -b binary gtk/gtk.gresource -o gtk/gtkresources_blob.o
ld.lld: error: target emulation unknown: -m or at least one .o file required

Workaround currently tested as works for me:

1. add `=gui-libs/gtk-4.12.5 ~amd64` to /etc/portage/package.accept_keywords
2. emerge -va1 =gui-libs/gtk-4.12.5
Comment 17 ernsteiswuerfel archtester 2024-01-12 16:04:12 UTC
Fixed in gtk-4.12.4.
Comment 18 Mart Raudsepp gentoo-dev 2024-02-11 14:02:18 UTC
So can this bug and the associated GitHub PR be closed now?