From ad4e538a7a03a36728d6a4954de3a28474be3281 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Wed, 13 May 2026 13:24:51 +0200 Subject: [PATCH] fix(aur): export RUSTFLAGS in PKGBUILD to actually pin ld.bfd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 8383746 added .cargo/config.toml with rustflags=link-arg=-fuse-ld=bfd but the chroot still linked with `-fuse-ld=lld`. cargo's RUSTFLAGS env var takes precedence over [target.X.rustflags] in any config.toml, so Arch's `extra/rust` pkg (which apparently sets its own RUSTFLAGS to default rustc to LLD) was overriding the project config silently. Set `export RUSTFLAGS="-C link-arg=-fuse-ld=bfd"` directly in the PKGBUILD's build() and check() functions. This is the highest- precedence place — beats Arch's defaults, beats the project config, beats any inherited env. Confirmed via the build-log chain in build-logs/aur-test-20260513-132012.log: the link line still contained `-fuse-ld=lld` despite the .cargo/config.toml landing in the tarball. `.cargo/config.toml` is kept (commit 8383746) so the local rustup toolchain mirrors the chroot's linker. Belt-and-braces. Re-run `just aur-local-test owlry`. Expected link line should now contain `-fuse-ld=bfd` and the build should complete. --- aur/owlry/PKGBUILD | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/aur/owlry/PKGBUILD b/aur/owlry/PKGBUILD index f038858..7975556 100644 --- a/aur/owlry/PKGBUILD +++ b/aur/owlry/PKGBUILD @@ -86,6 +86,15 @@ build() { cd "owlry" export RUSTUP_TOOLCHAIN=stable export CARGO_TARGET_DIR=target + # Force GNU ld.bfd. Arch's `extra/rust` defaults rustc to `-fuse-ld=lld`, + # and LLD's single-pass arg processing can't satisfy `-llua5.4` because + # mlua-sys+lua-src emit the `-l` flag before their `-L $OUT_DIR/lib` + # search path in the final link line (cargo:rustc-link-lib emitted + # before cargo:rustc-link-search). BFD does multi-pass and finds the + # archive regardless. RUSTFLAGS env-var beats any cargo config rustflags, + # which is necessary here because Arch's rust pkg appears to set its own + # RUSTFLAGS that we need to fully override. + export RUSTFLAGS="-C link-arg=-fuse-ld=bfd" # 'full' enables every optional provider — the AUR binary is the # batteries-included experience. cargo install consumers can still opt # to --no-default-features and pick their own subset. @@ -96,6 +105,7 @@ check() { cd "owlry" export RUSTUP_TOOLCHAIN=stable export CARGO_TARGET_DIR=target + export RUSTFLAGS="-C link-arg=-fuse-ld=bfd" cargo test --frozen --release --features full }