Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 943208 - sys-fs/bcachefs-tools-1.11.0 Fails to compile with -Clinker-plugin-lto - error: linking with `cc` failed: exit status: 1
Summary: sys-fs/bcachefs-tools-1.11.0 Fails to compile with -Clinker-plugin-lto - erro...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Matt Jolly
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-10 22:57 UTC by immolo
Modified: 2024-11-10 23:14 UTC (History)
3 users (show)

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


Attachments
build.log (bcachefs-tools.log,210.75 KB, text/x-log)
2024-11-10 22:57 UTC, immolo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description immolo 2024-11-10 22:57:24 UTC
Created attachment 908438 [details]
build.log

Compiling anstyle-parse v0.2.3
     Running `rustc --crate-name anstyle_parse --edition=2021 /var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/cargo_home/gentoo/anstyle-parse-0.2.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="utf8"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("core", "default", "utf8"))' -C metadata=bab0720c47a13f7c -C extra-filename=-bab0720c47a13f7c --out-dir /var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/bcachefs-tools-1.11.0/target/release/deps -L dependency=/var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/bcachefs-tools-1.11.0/target/release/deps --extern utf8parse=/var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/bcachefs-tools-1.11.0/target/release/deps/libutf8parse-1292027d01656d3e.rmeta --cap-lints allow -Clinker-plugin-lto -Ctarget-cpu=native`
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/bin:/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/bin:/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/bin:/var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/temp/python3.13/bin:/usr/lib/portage/python3.13/ebuild-helpers/xattr:/usr/lib/portage/python3.13/ebuild-helpers:/opt/stuffit/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/19/bin:/usr/lib/llvm/17/bin:/opt/intel/oneapi/mkl/2023.0.0/bin/intel64:/etc/eselect/wine/bin:/opt/cuda/bin" VSLANG="1033" "cc" "-m64" "/var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/temp/rustc7Zj6WJ/symbols.o" "/var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/bcachefs-tools-1.11.0/target/release/build/prettyplease-ba378588a0b0404b/build_script_build-ba378588a0b0404b.build_script_build.a51299bc6655cc31-cgu.0.rcgu.o" "/var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/bcachefs-tools-1.11.0/target/release/build/prettyplease-ba378588a0b0404b/build_script_build-ba378588a0b0404b.cb0i4jgctjokbkovaj0upywjf.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-22be60875a4ac8d7.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4b832a03827ff95e.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-a25e7f31e2204719.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-1f1858edbb50ccb5.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1319b75889377807.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-c9972d847170eb93.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0868a75d0b80f801.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-f4254a923640cbea.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-f21de9b2e2c92770.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-cf868f78468d45dd.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-cce9a55233783113.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-6ef1f692f91f321e.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-d2b4a3bc57672e2c.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-9d8e4e6f4cb45592.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-858b7338441a56b6.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-d182631d04e1eed2.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-7874c355ab5ed077.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-46b25da62cc69443.rlib" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-c71612932829263c.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-Wl,-plugin-opt=O0,-plugin-opt=mcpu=znver3" "-L" "/opt/rust-bin-1.82.0/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/bcachefs-tools-1.11.0/target/release/build/prettyplease-ba378588a0b0404b/build_script_build-ba378588a0b0404b" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /var/tmp/portage/sys-fs/bcachefs-tools-1.11.0/work/bcachefs-tools-1.11.0/target/release/build/prettyplease-ba378588a0b0404b/build_script_build-ba378588a0b0404b.build_script_build.a51299bc6655cc31-cgu.0.rcgu.o: file not recognized: file format not recognized
          collect2: error: ld returned 1 exit status

Steps to reproduce:

1. Add -flto to COMMON_FLAGS and -Clinker-plugin-lto to RUSTFLAGS
2. emerge -va bcachefs-tools

emerge --info:

Portage 3.0.66.1 (python 3.13.0-final-0, default/linux/amd64/23.0/desktop, gcc-14, glibc-9999, 6.11.5-gentoo-dist x86_64)
=================================================================
System uname: Linux-6.11.5-gentoo-dist-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.39.9000
KiB Mem:    65744176 total,   9934012 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Fri, 08 Nov 2024 11:48:28 +0000
Head commit of repository gentoo: bfe1cfef7f18bc6f074516fe3d68f63fa615621e

Head commit of repository cosmic-overlay: 7c3866da5d36d96945ec0d1ecc161f090f96e425

Timestamp of repository edgets: Wed, 06 Nov 2024 10:33:22 +0000
Head commit of repository edgets: c26ef2275e5aa2b6ab30cb5971bf47780f8584c5

Timestamp of repository guru: Fri, 08 Nov 2024 10:33:25 +0000
Head commit of repository guru: 7d6da054090edaa9016006a4fb5fb2ae59ee325c

Timestamp of repository parona-overlay: Thu, 07 Nov 2024 18:33:21 +0000
Head commit of repository parona-overlay: 4d26195fdd9ce4626328d9f2723731204416c5de

Timestamp of repository sft: Wed, 30 Oct 2024 16:33:15 +0000
Head commit of repository sft: e63a662234d31918647bbbbf4ee4278137ba65dc

Timestamp of repository steam-overlay: Tue, 08 Oct 2024 15:50:59 +0000
Head commit of repository steam-overlay: c802c22bb423cb84d975b3fc9cfe6bc9410d22cd

Timestamp of repository wayland-desktop: Mon, 14 Oct 2024 12:50:43 +0000
Head commit of repository wayland-desktop: 72e2e53f3b71aac34a65fd64b8cb527b0ac1e613

sh bash 5.2_p37
ld GNU ld (Gentoo 2.43 p2) 2.43.1
app-misc/pax-utils:        1.3.8::gentoo
app-shells/bash:           5.2_p37::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo, 1.17-r1::gentoo
dev-build/cmake:           3.30.5::gentoo
dev-build/libtool:         2.5.3::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           9999::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.11.10_p1::gentoo, 3.12.7_p1::gentoo, 3.13.0::gentoo
dev-lang/rust:             1.80.1::cosmic-overlay
dev-lang/rust-bin:         1.82.0::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54.2::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.42-r1::gentoo, 2.43-r1::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/clang:           17.0.6::gentoo, 18.1.6::gentoo
sys-devel/gcc:             12.3.1_p20240502::gentoo, 13.2.1_p20240210::gentoo, 14.1.1_p20240518::gentoo, 15.0.0_pre20241020-r2::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             17.0.6::gentoo, 18.1.5::gentoo
sys-devel/llvm:            17.0.6::gentoo, 18.1.8-r4::gentoo, 19.1.2::gentoo
sys-kernel/linux-headers:  6.11::gentoo (virtual/os-headers)
sys-libs/glibc:            9999::gentoo
Repositories:

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

cosmic-overlay
    location: /var/db/repos/cosmic-overlay
    sync-type: git
    sync-uri: https://github.com/fsvm88/cosmic-overlay.git
    masters: gentoo
    volatile: False

edgets
    location: /var/db/repos/edgets
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/edgets.git
    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

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

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

py3_13
    location: /var/db/repos/py3_13
    masters: gentoo
    volatile: False

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

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

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

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -flto"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /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"
CXXFLAGS="-O2 -march=native -pipe -flto"
DISTDIR="/var/cache/distfiles"
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 -march=native -pipe -flto"
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 merge-wait multilib-strict network-sandbox news parallel-fetch 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 -march=native -pipe -flto"
GENTOO_MIRRORS="https://mirror.bytemark.co.uk/gentoo/     https://mirrors.gethosted.online/gentoo/"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
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"
RUSTFLAGS=" -Clinker-plugin-lto -Ctarget-cpu=native"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cet crypt dbus dri dts dvd dvdr elogind encode exif flac gdbm gif gpm gtk gui iconv icu ipv6 jpeg kf6compat lcms libnotify libtirpc lto mad mng mp3 mp4 mpeg multilib ncurses networkmanager nls ogg opengl openmp opus pam pango pcre pdf pgo pipewire png policykit ppds pulseaudio qml readline sdl seccomp sound spell ssl startup-notification svg test-rust tiff truetype udev udisks unicode upower usb vorbis vulkan wayland webp wxwidgets x264 xattr xcb xft xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gcc_12" 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="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3 vpclmulqdq" 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" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB" 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_13" PYTHON_TARGETS="python3_12 python3_13" QEMU_SOFTMMU_TARGETS="aarch64 i386 x86_64 ppc m68k sh4 sh4eb hppa alpha" QEMU_USER_TARGETS="m68k sh4 sh4eb aarch64 hppa riscv64 riscv32 alpha ppc64le" RUBY_TARGETS="ruby32" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto 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, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-10 22:59:35 UTC
It's arguably invalid user configuration to try to use RUSTFLAGS containing -Clinker-plugin-lto with GCC because the whole point is you're saying "do LTO cross-language" which means you must be using Clang.

But we could maybe try to filter it in the eclass, I guess.
Comment 2 immolo 2024-11-10 23:03:35 UTC
The Rust docs aren't the most clearest but it does seem to supported from reading https://doc.rust-lang.org/rustc/linker-plugin-lto.html
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-10 23:05:23 UTC
(In reply to immolo from comment #2)
> The Rust docs aren't the most clearest but it does seem to supported from
> reading https://doc.rust-lang.org/rustc/linker-plugin-lto.html

How could it be if you're building with GCC? I'm saying that if you're setting it, you should be using Clang.

The page even says "The prime example here would be linking Rust code together with Clang-compiled C/C++ code.".
Comment 4 immolo 2024-11-10 23:14:17 UTC
I see it now, I read a part incorrectly as GCC.