Closed roland-5 closed 1 year ago
It is very likely that -flto
is missing in the link command line. Please make sure that you passed -flto
when you link LTO object files.
I don't think you're using mold correctly with cargo here. You should add -C link-arg=-fuse-ld=mold
to RUSTFLAGS
. Aka, clang invoked as linker probably thinks it's working with bfd because it only sees --ld-path=mold
.
Argh, you are right, I used old makepkg.conf
... In new my RUSTFLAGS
is:
CARGO_PROFILE_RELEASE_LTO="thin"
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang
RUSTFLAGS="-C opt-level=3 -C target-cpu=native -C linker=clang -C linker-plugin-lto -C link-arg=-flto -C link-arg=-fuse-ld=mold"
I tried now to build it in fresh environment but without success: https://gist.github.com/roland-5/9cb29cbaf09453b9e62d3e700997909a
You can't do Rust LTO with LLVM IR plugin from system LLVM. Rust bundles its own build of LLVM which is incompatible. The only compatible way is to use the LLD shipped with the Rust toolchain.
@roland-5
Please try to add options=(!lto)
to your PKGBUILD and check if it is working then. The LTO option array of archlinux does not play well together with rust and most AUR maintainer don't check their packages against it, even if it is default for devtools/chroot build packages.
Thank you all for comments. @ptr1337 That was it, thanks!
I'm trying build typst-lsp from Arch Linux AUR with mold version
2.2.0
, but it vomit this:My
/etc/makepkg.conf