fix(aur): export RUSTFLAGS in PKGBUILD to actually pin ld.bfd

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.
This commit is contained in:
2026-05-13 13:24:51 +02:00
parent 8383746a72
commit ad4e538a7a
+10
View File
@@ -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
}