View previous topic :: View next topic |
Author |
Message |
causality Apprentice

Joined: 03 Jun 2006 Posts: 241
|
Posted: Wed Feb 19, 2025 9:12 pm Post subject: www-client/chromium refuses to use LTO [SOLVED] |
|
|
Hello,
When I go to build (update) www-client/chromium, this is the first portion of the emerge output:
Code: | Calculating dependencies ... done!
Dependency resolution took 90.07 s (backtrack: 0/20).
>>> Verifying ebuild manifests
>>> Running pre-merge checks for www-client/chromium-133.0.6943.98
* Checking for at least 4 GiB RAM ... [ ok ]
* Checking for at least 25 GiB disk space at "/var/tmp/notmpfs/portage/www-client/chromium-133.0.6943.98/temp" ... [ ok ]
>>> Emerging (1 of 1) www-client/chromium-133.0.6943.98::gentoo
* chromium-133.0.6943.98-linux.tar.xz BLAKE2B SHA512 size ;-) ... [ ok ]
* chromium-patches-133-2.tar.bz2 BLAKE2B SHA512 size ;-) ... [ ok ]
* Checking for at least 4 GiB RAM ... [ ok ]
* Checking for at least 25 GiB disk space at "/var/tmp/notmpfs/portage/www-client/chromium-133.0.6943.98/temp" ... [ ok ]
* USE=official selected and LTO not detected.
* It is _highly_ recommended that LTO be enabled for performance reasons
* and to be consistent with the upstream "official" build optimisations. |
This is using the Clang compiler. Both my Clang and GCC compilers fully support LTO and most packages just follow my global CFLAGS/CXXFLAGS as specified in make.conf for system-wide LTO. For some reason, this package doesn't "detect" LTO and refuses to use it. I notice that the LTO USE flag is no longer present as it was in bygone days. My understanding is that this USE flag enabled special per-package workarounds to get LTO to work, so its evaporation is mostly a good thing.
I did some digging and it seems like this portion of /usr/portage/www-client/chromium/chromium-133.0.6943.98.ebuild is relevant:
Code: | pkg_setup() {
if [[ ${MERGE_TYPE} != binary ]]; then
# The pre_build_checks are all about compilation resources, no need to run it for a binpkg
pre_build_checks
# The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment
# We'll set these to clang here then use llvm-utils functions to very explicitly set these
# to a sane value.
# This is effectively the 'force-clang' path if GCC support is re-added.
# TODO: check if the user has already selected a specific impl via make.conf and respect that.
use_lto="false"
if tc-is-lto; then
use_lto="true"
# We can rely on GN to do this for us; anecdotally without this builds
# take significantly longer with LTO enabled and it doesn't hurt anything.
filter-lto
fi
if [ "$use_lto" = "false" ] && use official; then
einfo "USE=official selected and LTO not detected."
einfo "It is _highly_ recommended that LTO be enabled for performance reasons"
einfo "and to be consistent with the upstream \"official\" build optimisations."
fi
if [ "$use_lto" = "false" ] && use test; then
die "Tests require CFI which requires LTO"
fi |
What is that function "tc-is-lto" actually checking and why would it fail to detect that my toolchain supports (or should be using) LTO? I tracked it down to the file /usr/portage/eclass/toolchain-funcs.eclass and towards the end of this file, I found:
Code: | tc-is-lto() {
local f="${T}/test-lto.o"
local ret=1
case $(tc-get-compiler-type) in
clang)
$(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
# If LTO is used, clang will output bytecode and llvm-bcanalyzer
# will run successfully. Otherwise, it will output plain object
# file and llvm-bcanalyzer will exit with error.
llvm-bcanalyzer "${f}" &>/dev/null && ret=0
;;
gcc)
$(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
[[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && ret=0
;;
esac
rm -f "${f}" || die
return "${ret}"
} |
From here, I don't know why it's failing.
Output of emerge --info:
Code: | # emerge --info
Portage 3.0.66.1 (python 3.12.8-final-0, default/linux/amd64/23.0/desktop/plasma, gcc-14, glibc-2.40-r8, 6.13.2-gentoo x86_64)
=================================================================
System uname: Linux-6.13.2-gentoo-x86_64-Intel-R-_Core-TM-_i5-6500_CPU_@_3.20GHz-with-glibc2.40
KiB Mem: 16354724 total, 5338232 free
KiB Swap: 3145724 total, 3030700 free
Timestamp of repository gentoo: Sat, 15 Feb 2025 20:15:00 +0000
Head commit of repository gentoo: 556e8be92c82c3777947ae79ccdc9cae0b7df4a7
Timestamp of repository myrvolay: Sat, 15 Feb 2025 07:22:14 +0000
Head commit of repository myrvolay: bf2e71e537e4c8b986d3d752ccb667360dc524ea
sh bash 5.2_p37
ld GNU ld (Gentoo 2.42 p6) 2.42.0
app-misc/pax-utils: 1.3.8::gentoo
app-shells/bash: 5.2_p37::gentoo
dev-build/autoconf: 2.13-r8::gentoo, 2.72-r1::gentoo
dev-build/automake: 1.16.5-r2::gentoo
dev-build/cmake: 3.30.6::gentoo
dev-build/libtool: 2.5.4::gentoo
dev-build/make: 4.4.1-r100::gentoo
dev-build/meson: 1.6.1::gentoo
dev-lang/perl: 5.40.0-r1::gentoo
dev-lang/python: 3.12.8_p1::gentoo, 3.13.1_p1::gentoo
dev-lang/rust-bin: 1.81.0-r100::gentoo, 1.82.0-r101::gentoo, 1.83.0-r1::gentoo
llvm-core/clang: 18.1.8-r6::gentoo, 19.1.7::gentoo
llvm-core/lld: 18.1.8::gentoo, 19.1.7::gentoo
llvm-core/llvm: 18.1.8-r6::gentoo, 19.1.7::gentoo
sys-apps/baselayout: 2.17::gentoo
sys-apps/openrc: 0.55.1::gentoo
sys-apps/sandbox: 2.39::gentoo
sys-devel/binutils: 2.42-r2::gentoo, 2.43-r2::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/gcc: 14.2.1_p20241221::gentoo
sys-devel/gcc-config: 2.12.1::gentoo
sys-kernel/linux-headers: 6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc: 2.40-r8::gentoo
Repositories:
gentoo
location: /usr/portage
sync-type: rsync
sync-uri: rsync://rsync.us.gentoo.org/gentoo-portage
priority: -1000
volatile: True
sync-rsync-verify-jobs: 1
sync-rsync-verify-metamanifest: yes
sync-rsync-verify-max-age: 24
sync-rsync-extra-opts:
myrvolay
location: /var/db/repos/myrvolay
sync-type: git
sync-uri: https://github.com/gentoo-mirror/myrvolay.git
masters: gentoo
volatile: False
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
AR="gcc-ar"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -fomit-frame-pointer -fsched-pressure -ftree-loop-distribution -fweb -frename-registers -floop-interchange -ftree-vectorize -fivopts -pipe -flto=auto -fuse-linker-plugin -floop-nest-optimize -fgraphite-identity"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind"
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"
CXXFLAGS="-O2 -march=native -fomit-frame-pointer -fsched-pressure -ftree-loop-distribution -fweb -frename-registers -floop-interchange -ftree-vectorize -fivopts -pipe -flto=auto -fuse-linker-plugin -floop-nest-optimize -fgraphite-identity"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=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 buildpkg-live candy config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news pid-sandbox pkgdir-index-trusted 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="http://gentoo.mirror.root.lu/"
LANG="C.UTF8"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,now -Wl,--strip-debug -O2 -march=native -fomit-frame-pointer -fsched-pressure -ftree-loop-distribution -fweb -frename-registers -floop-interchange -ftree-vectorize -fivopts -pipe -flto=auto -fuse-linker-plugin -floop-nest-optimize -fgraphite-identity"
LEX="flex"
MAKEOPTS="-j4"
NM="gcc-nm"
PKGDIR="/usr/portage/packages"
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="gcc-ranlib"
SHELL="/bin/bash"
USE="3dnow 3dnowext X \ a52 aac aalib acl acpi activities alsa amd64 bash-completion branding bzip2 cairo cdda cdr cet crypt cups dbus declarative dri dts dvd dvdr elogind encode exif ffmpeg flac gdbm gif gpm gtk gui iconv icu ipv6 jpeg jpeg2k kde kf6compat kwallet lcms libnotify libtirpc lzma mad mng mp3 mp4 mpeg mplayer multilib mysql ncurses networkmanager nvenc offensive ogg opengl openmp openssl pam pango pcre pdf plasma png policykit ppds python qml qt5 qt6 readline sdl seccomp socks5 sound spell ssl startup-notification svg symlink test-rust tiff truetype udev udisks unicode upower usb verify-sig videos vorbis vulkan wayland widgets wmf wxwidgets x264 xattr xcb xcomposite xft xine xml xscreensaver xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gcc_13" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="pc" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="en en-US" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby32" VIDEO_CARDS="nvidia nv vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset: ADDR2LINE, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS |
Also, these are the USE flags enabled for www-client/chromium:
Code: | # equery uses chromium
[ Legend : U - final flag setting for installation]
[ : I - package is installed with flag ]
[ Colors : set, unset ]
* Found these USE flags for www-client/chromium-133.0.6943.98:
U I
+ + X : Add support for X11
- - bindist : Flag to enable or disable options for prebuilt (GRP) packages (eg. due to licensing issues)
+ + cups : Add support for CUPS (Common Unix Printing System)
- - custom-cflags : Build with user-specified CFLAGS (unsupported)
- - debug : Enable DCHECK feature with severity configurable at runtime. Mostly intended for debugging and
development, NOT RECOMMENDED for general use.
- - ffmpeg-chromium : (binpkg only) Use Chromium FFmpeg fork (media-video/ffmpeg-chromium) rather than mainline FFmpeg
(media-video/ffmpeg)
- - gtk4 : Build with GTK4 headers.
- - hangouts : Enable support for Google Hangouts features such as screen sharing
- - kerberos : Add kerberos support
- - l10n_af : Afrikaans
- - l10n_am : Amharic
- - l10n_ar : Arabic
- - l10n_bg : Bulgarian
- - l10n_bn : Bengali
- - l10n_ca : Catalan
- - l10n_cs : Czech
- - l10n_da : Danish
- - l10n_de : German
- - l10n_el : Modern Greek
- - l10n_en-GB : English (United Kingdom)
- - l10n_es : Spanish
- - l10n_es-419 : Spanish (Latin America)
- - l10n_et : Estonian
- - l10n_fa : Persian
- - l10n_fi : Finnish
- - l10n_fil : Filipino
- - l10n_fr : French
- - l10n_gu : Gujarati
- - l10n_he : Hebrew
- - l10n_hi : Hindi
- - l10n_hr : Croatian
- - l10n_hu : Hungarian
- - l10n_id : Indonesian
- - l10n_it : Italian
- - l10n_ja : Japanese
- - l10n_kn : Kannada
- - l10n_ko : Korean
- - l10n_lt : Lithuanian
- - l10n_lv : Latvian
- - l10n_ml : Malayalam
- - l10n_mr : Marathi
- - l10n_ms : Malay (macrolanguage)
- - l10n_nb : Norwegian Bokmål
- - l10n_nl : Dutch
- - l10n_pl : Polish
- - l10n_pt-BR : Portuguese (Brazil)
- - l10n_pt-PT : Portuguese (Portugal)
- - l10n_ro : Romanian
- - l10n_ru : Russian
- - l10n_sk : Slovak
- - l10n_sl : Slovenian
- - l10n_sr : Serbian
- - l10n_sv : Swedish
- - l10n_sw : Swahili (macrolanguage)
- - l10n_ta : Tamil
- - l10n_te : Telugu
- - l10n_th : Thai
- - l10n_tr : Turkish
- - l10n_uk : Ukrainian
- - l10n_ur : Urdu
- - l10n_vi : Vietnamese
- - l10n_zh-CN : Chinese (China)
- - l10n_zh-TW : Chinese (Taiwan)
+ - llvm_slot_19 : Use LLVM 19.
+ - official : Enable Official build instead of Developer build.
- - pax-kernel : Allow building on a PaX-enabled kernel
+ - proprietary-codecs : Enable codecs for patent-encumbered audio and video formats.
- - pulseaudio : Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire)
+ + qt6 : Add support for the Qt 6 application and UI framework
- - screencast : Enable support for remote desktop and screen cast using PipeWire
+ - system-harfbuzz : Use system media-libs/harfbuzz instead of the bundled library.
+ - system-png : Use system media-libs/libpng instead of the bundled library
+ - system-zstd : Use system app-arch/zstd instead of the bundled one.
- - test : Enable dependencies and/or preparations necessary to run tests (usually controlled by
FEATURES=test but can be toggled independently)
+ - vaapi : Enable Video Acceleration API for hardware decoding
+ + wayland : Enable dev-libs/wayland backend
+ - widevine : Unsupported closed-source DRM capability (required by Netflix VOD) |
|
|
Back to top |
|
 |
causality Apprentice

Joined: 03 Jun 2006 Posts: 241
|
Posted: Thu Feb 20, 2025 5:11 pm Post subject: |
|
|
So, I apparently overlooked something. For a long time, the state of LTO on Linux meant that some packages would break with it. Chromium was one of those.
I use system-wide LTO. It turns out, I wrote a package.env file that overrode variables like CFLAGS and LDFLAGS to remove LTO for specific packages. Wouldn't you know, Chromium was historically one of those? I removed the Chromium-specific package.env entry for a file I named no-lto.conf from package.env and now Chromium builds with LTO just fine. I did still have to tweak package.env a bit since Chromium rejects the mold linker, but that was trivial. So far, it's happily building.
Thank you, everyone, for your time reading this. You are very much appreciated. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|