Emerging www-client/firefox-132.0.1-r1 fails with * Building firefox with lto and requires the sys-devel/lld or sys-devel/mold linker! * ERROR: www-client/firefox-132.0.1-r1::gentoo failed (setup phase): * Please fix your toolchain configuration. My relevant settings are the following: * Default toolchain is gcc and ld (not lld!) * I do have -flto in my CFLAGS, CXXFLAGS and LDFLAGS, because I want both gcc and clang to compile with lto by default. But I don't have any -fuse-ld= in my ...FLAGS (because having any fixed -fuse-ld= together with -flto would cause either the ebuilds using gcc or the ebuilds using clang to fail) * Clang and lld is installed * USE=default-lld is set for clang-common, so clang should always use lld, even without having -fuse-ld=lld in ...FLAGS, and even with ld being the default linker. * USE=clang and USE=lto is set for firefox As far as I can tell, with all previous firefox ebuilds this worked as desired (and should have worked even without USE=default-lld for clang), i.e. firefox was compiled and linked with clang, lto and lld, due to the following piece of code in src_configure(), which explicitely sets the linker to lld if clang and lto is used, independently of the default toolchain linker. if use lto ; then if use clang ; then # Upstream only supports lld or mold when using clang. if tc-ld-is-mold ; then # mold expects the -flto line from *FLAGS configuration, bgo#923119 append-ldflags "-flto=thin" mozconfig_add_options_ac "using ld=mold due to system selection" --enable-linker=mold else mozconfig_add_options_ac "forcing ld=lld due to USE=clang and USE=lto" --enable-linker=lld fi firefox-132.0.1-r1 also contains these lines in src_configure(), so it would choose lld for linking anyway, but it tests the default toolchain linker in pkg_setup() long before setting the desired lld linker for USE=clang and USE=lto, and fails with the message above if the default linker is not lld.
Pretty sure tc-ld-is-lld is calling probably checking with GCC. I did end up setting up a /etc/portage/env with `LDFLAGS="${LDFLAGS} -fuse-ld=lld"` and built fine. Personally I would favor removing the tc-ld-is-lld check and just depend on the ebuild fixing the toolchain itself, I'm not aware of this ever being an issue, but I could be wrong.
I removed the check from the ebuild and ran the ebuild again. It finished successfully, and looking at the running processes, it compiled with clang, linked with lld, and had the thinlto options set for both.
(In reply to Michael Cook from comment #1) > Personally I would favor removing the tc-ld-is-lld check and just depend on > the ebuild fixing the toolchain itself, I'm not aware of this ever being an > issue, but I could be wrong. See the discussion in bug 943109.
I think this issue is sorted now, see comments in bug 943116.
The current firefox-132.0.1-r1.ebuild ebuild works for me. Fixed at least for my settings.