-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Problem
Since rust-lang/rust#83820 #[link_args] attribute was removed. According to specification of that PR new crates should use build scripts with code like that:
println!("cargo:rustc-link-arg-bins={}", arg);However, the problem is that extra-link-arg is mentioned in the documentation of cargo unstable features, but can't used in cargo-features. So, you can only pass it as CLI option right now.
Steps (it is assumed that you are using x86_64-pc-windows-msvc toolchain)
git clone --branch=fix-link-args https://github.com/Frago9876543210/min-sized-rust-windows.gitcd min-sized-rust-windowscargo build --release
Lot of warning: cargo:rustc-link-arg-bins requires -Zextra-link-arg flag as result.
The only way to bypass that problem is custom aliases or manually adding -Zextra-link-arg everywhere.
Possible Solution(s)
Make possible to fallback cargo-features to -Z <feature-name> instead of hardcoded values here?
cargo/src/cargo/core/features.rs
Lines 218 to 219 in e0f9643
| // Allow to specify whether binaries should be stripped. | |
| [unstable] strip: bool, |
Notes
Output of cargo version:
cargo 1.53.0-nightly (65d57e6f3 2021-04-04)
Output of rustc -V --verbose:
rustc 1.53.0-nightly (b0c818c5e 2021-04-16)
binary: rustc
commit-hash: b0c818c5e0fa37251d9fda2f656bf1041a2e1e1d
commit-date: 2021-04-16
host: x86_64-pc-windows-msvc
release: 1.53.0-nightly
LLVM version: 12.0.0