Summary: | dev-lang/rust-1.84.0 fails to build with lto+bfd | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sven B. <s.bahro+bgo> |
Component: | Current packages | Assignee: | Randy Barlow <randy> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | matoro_gentoo, navi, onun23, rodolfo.boer, rust, s.bahro+bgo, zhixu.liu, zyx |
Priority: | Normal | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
See Also: | https://github.com/gentoo/gentoo/pull/40772 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
rust-1.84.0 build log
emerge info build.log,xz |
Created attachment 916420 [details]
emerge info
ok, seems to be an lto+bfd issue. According to e.g. https://github.com/rust-lang/rust/issues/54971 this happens quite frequently. Using lld as in the referenced bug fixed the issue. same problem today, build success after remore USE="lto" (In reply to Zhixu Liu from comment #3) > same problem today, build success after remore USE="lto" updated: use profile default/linux/amd64/23.0/hardened CC=gcc CXX=g++ USE="lto" emerge -Ov1e =rust-1.84.1 success CC=clang CXX=clang++ USE="lto" emerge -Ov1e =rust-1.84.1 failed IIRC, I'm always use the later for emerge, never failed, seemes the failed start from 1.84.0 bfd can't work with Clang LTO (at least without using hacky plugin or maybe not at all). I'm surprised it ever worked. (In reply to Sam James from comment #5) > bfd can't work with Clang LTO (at least without using hacky plugin or maybe > not at all). I'm surprised it ever worked. hmm, it works for me until 1.84, :( so we should handle this in ebuild too, i think? I think the configuration is invalid... it'll definitely fail on other packages too. For anyone trying this too and getting an error I managed to get it working with this use flags: +clippy +cpu_flags_x86_sse2 +doc +llvm_targets_NVPTX +lto +nightly +parallel-compiler +rust-analyzer +rust-src +rustfmt +system-llvm +verify-sig env: CFLAGS="-O2 -march=native -flto=thin" CXXFLAGS="${CFLAGS}" LDFLAGS="-fuse-ld=lld" CC="clang" CXX="clang++" LD="ld.lld" AR="llvm-ar" NM="llvm-nm" RANLIB="llvm-ranlib" RUSTFLAGS="-C opt-level=2 -C target-cpu=native -C embed-bitcode=yes -C linker=clang -C link-arg=-fuse-ld=lld" *** Bug 950100 has been marked as a duplicate of this bug. *** (In reply to Nuno Alexandre from comment #8) > RUSTFLAGS="-C opt-level=2 -C target-cpu=native -C embed-bitcode=yes -C > linker=clang -C link-arg=-fuse-ld=lld" Is lto actually enabled if -Clinker-plugin-lto is missing? (In reply to rodolfo from comment #10) > (In reply to Nuno Alexandre from comment #8) > > RUSTFLAGS="-C opt-level=2 -C target-cpu=native -C embed-bitcode=yes -C > > linker=clang -C link-arg=-fuse-ld=lld" > > Is lto actually enabled if -Clinker-plugin-lto is missing? With USE="lto" yes RUSTFLAGS="-C link-arg=-fuse-ld=lld" is enough, but the problem is "llvm-core/lld" is not in BDEPEND, so it still failed if lld is not emerged.
I don't know howto add llvm-core/lld into BDEPEND, like bellow:
> if use lto && tc-is-clang ; then
> BDEPEND+="llvm-core/lld"
> fi
Created attachment 920386 [details]
build.log,xz
|
Created attachment 916419 [details] rust-1.84.0 build log 1.84.0 fails to build, 1.83.0-r1 builds fine. = note: /usr/bin/x86_64-pc-linux-gnu-ld.bfd: /var/tmp/portage/dev-lang/rust-1.84.0/temp/rustco5smjh/librustc_codegen_llvm-66164a4ba99020e3.rlib: error adding symbols: file format not recognized clang-19: error: linker command failed with exit code 1 (use -v to see invocation) (...) ------------- error: could not compile `rustc_driver` (lib) due to 1 previous error