Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 869758 - app-shells/starship: undefined reference to `inflate' with LTO
Summary: app-shells/starship: undefined reference to `inflate' with LTO
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Randy Barlow
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2022-09-11 15:57 UTC by immolo
Modified: 2022-10-04 13:44 UTC (History)
3 users (show)

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


Attachments
Build.log (starship.build.log,371.75 KB, text/x-log)
2022-09-11 15:58 UTC, immolo
Details
Attempt to patch (starship-1.10.2-nolto.patch,222 bytes, patch)
2022-09-12 07:08 UTC, immolo
Details | Diff
envionment file (environment,101.01 KB, text/plain)
2022-09-12 15:15 UTC, immolo
Details
diff (starship-1.10.2.diff,546 bytes, patch)
2022-09-13 06:58 UTC, immolo
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description immolo 2022-09-11 15:57:59 UTC
Since moving my system to LTO I've been unable to get Starship to compile on my system with an issue being hinted towards being in zlib.

I've current tried removing -FLTO from zlib but the error still persists and I've also patched out the upstream enabled LTO setting in the Cargo.toml for Starship which also has the same error.

Reproducible: Always

Actual Results:  
See build.log
Comment 1 immolo 2022-09-11 15:58:29 UTC
Created attachment 804709 [details]
Build.log
Comment 2 immolo 2022-09-11 15:59:04 UTC
emerge --info

Portage 3.0.36 (python 3.10.7-final-0, default/linux/amd64/17.1/desktop, gcc-12.2.0, glibc-2.35-r8, 5.18.18-gentoo-dist x86_64)
=================================================================
System uname: Linux-5.18.18-gentoo-dist-x86_64-Intel-R-_Core-TM-_i7-6700K_CPU_@_4.00GHz-with-glibc2.35
KiB Mem:    16349108 total,   3385472 free
KiB Swap:   16777212 total,  15987452 free
Timestamp of repository gentoo: Sun, 11 Sep 2022 12:30:01 +0000
Head commit of repository gentoo: 8591b592d886d9582286dfd8ce50c2938fae12db
Timestamp of repository steam-overlay: Wed, 07 Sep 2022 08:26:00 +0000
Head commit of repository steam-overlay: 78208ca83614c4cc031ca8f8ec9b023a5c9c3b1e

sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.38 p4) 2.38
distcc 3.4 x86_64-pc-linux-gnu [disabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.36.0::gentoo
dev-lang/python:           3.10.7::gentoo, 3.11.0_rc1_p2::gentoo
dev-lang/rust:             1.62.1::gentoo
dev-util/cmake:            3.24.1::gentoo
dev-util/meson:            0.63.2::gentoo
sys-apps/baselayout:       2.8-r2::gentoo
sys-apps/openrc:           0.45.2::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.13-r2::gentoo, 2.71-r2::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo, 2.39-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           14.0.6-r1::gentoo, 15.0.0::gentoo
sys-devel/gcc:             12.2.0::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/lld:             14.0.6::gentoo
sys-devel/llvm:            14.0.6-r2::gentoo, 15.0.0::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.19::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r8::gentoo
Repositories:

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

cinnamon
    location: /var/db/repos/cinnamon
    masters: gentoo

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32"
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"
CXXFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY 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"
FCFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live 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="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
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"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli crypt cups d3d9 dbus dist-kernel dri dts dvd dvdr elogind encode evdev exif flac fortran gdbm gif gpm graphite gtk gtk3 gui iconv icu introspection ipv6 jpeg lcms libglvnd libnotify libtirpc lto mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf pgo png policykit ppds pulseaudio readline sdl seccomp spell split-usr ssl startup-notification svg tiff truetype udev udisks unicode upower usb vaapi vdpau vorbis vulkan vulkan-overlay wxwidgets x264 xattr xcb xinerama xml xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gnat_2020" 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 sse3 sse4_1 sse4_2 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="lininput evdev joystick" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_SOFTMMU_TARGETS="i386 ppc ppc64 riscv32 riscv64 x86_64" QEMU_USER_TARGETS="i386 ppc ppc64 riscv32 riscv64 x86_64" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="nvidia intel" 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:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 3 Ionen Wolkens gentoo-dev 2022-09-11 23:54:16 UTC
ftr nearly no rust packages that happen to build C/C++ code (aka not rust) contained in crates currently work with lto, fairly typical to slap filter-lto on these ebuilds unless it's reasonably possible to skip it (e.g. system libraries exists and there's a variable to force using it).
Comment 4 immolo 2022-09-12 07:08:25 UTC
Created attachment 804790 [details, diff]
Attempt to patch

Filter-lto isn't going to work with this one as I've already disabledin package.env and patched it using this.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-12 12:00:32 UTC
(In reply to immolo from comment #4)
> Created attachment 804790 [details, diff] [details, diff]
> Attempt to patch
> 
> Filter-lto isn't going to work with this one as I've already disabledin
> package.env and patched it using this.

Are you sure you inherited flag-o-matic in the ebuild before trying filter-lto? This works for everybody else so I don't think it's likely to be as simple as this.
Comment 6 immolo 2022-09-12 12:39:24 UTC
I see where you are coming from on this so I'll explain why I don't think this will work.

# @FUNCTION: filter-lto
# @DESCRIPTION:
# Remove flags that enable LTO and those that depend on it
filter-lto() {
	[[ $# -ne 0 ]] && die "filter-lto takes no arguments"
	filter-flags '-flto*' -fwhole-program-vtables '-fsanitize=cfi*'

Is what I'm manually setting in a package.env but as this is rust I need to disable this in RUSTFLAGS which I'm doing with "-C linker-plugin-lto=no" which from my tests is turning it off but it still won't compile.

Now I could be wrong however but once flag-o-matic is added this will be achieving the same goal as Starship doesn't use commonflags.

Also it seems LTO is enabled by default from upstream so it seems strange why this is now occurring.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-12 13:01:51 UTC
(In reply to immolo from comment #6)
> I see where you are coming from on this so I'll explain why I don't think
> this will work.
> 
> # @FUNCTION: filter-lto
> # @DESCRIPTION:
> # Remove flags that enable LTO and those that depend on it
> filter-lto() {
> 	[[ $# -ne 0 ]] && die "filter-lto takes no arguments"
> 	filter-flags '-flto*' -fwhole-program-vtables '-fsanitize=cfi*'
> 
> Is what I'm manually setting in a package.env but as this is rust I need to
> disable this in RUSTFLAGS which I'm doing with "-C linker-plugin-lto=no"
> which from my tests is turning it off but it still won't compile.
> 
> Now I could be wrong however but once flag-o-matic is added this will be
> achieving the same goal as Starship doesn't use commonflags.
> 
> Also it seems LTO is enabled by default from upstream so it seems strange
> why this is now occurring.

This doesn't explain why it happens for only you (with LTO in your *FLAGS, no less).
Comment 8 immolo 2022-09-12 13:13:05 UTC
Indeed, this is as far as I've got to try and understand the issue.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-12 13:16:29 UTC
Can you upload the environment file when it fails?
Comment 10 immolo 2022-09-12 15:15:17 UTC
Created attachment 804850 [details]
envionment file

As requested.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-12 15:17:47 UTC
declare -x CFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32"

I thought you'd disabled LTO via package.env?
Comment 12 immolo 2022-09-13 06:58:31 UTC
Created attachment 804895 [details, diff]
diff

I am not a smart man....

Turns out I was package.env on sys-shell/starship rather than sys-shells/starship so lesson learnt and please see the fix.
Comment 13 Larry the Git Cow gentoo-dev 2022-10-04 13:44:41 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=68dde89f8b841cb0290cd36cfeb4638830689ed4

commit 68dde89f8b841cb0290cd36cfeb4638830689ed4
Author:     Randy Barlow <randy@electronsweatshop.com>
AuthorDate: 2022-10-01 17:48:42 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-10-04 13:44:27 +0000

    app-shells/starship: Filter LTO flags
    
    See also https://github.com/gentoo/gentoo/pull/27541/
    
    Closes: https://bugs.gentoo.org/869758
    Co-authored-by: Ian Jordan <immoloism@gmail.com>
    Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 app-shells/starship/starship-1.10.3.ebuild | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)