xargo
xargo copied to clipboard
cargo-features = ["strip"] cause compile error
I'm trying to use xargo to reduce space of binary file. min-sized-rust mentions it here. But cargo-features = ["strip"]
cause error.
This thing was recently added (see https://github.com/rust-lang/cargo/issues/3483).
$ RUST_BACKTRACE=1 xargo build --target x86_64-unknown-linux-gnu --release --verbose
# output:
+ "rustc" "--print" "sysroot"
+ RUSTFLAGS="--sysroot /home/alex/.xargo/HOST -Z force-unstable-if-unmarked"
+ "cargo" "build" "--release" "--manifest-path" "/tmp/xargo.Dax5TY8K3VlJ/Cargo.toml" "--target" "x86_64-unknown-linux-gnu" "-v" "-p" "std"
error: failed to parse manifest at `/tmp/xargo.Dax5TY8K3VlJ/Cargo.toml`
Caused by:
feature `strip` is required
consider adding `cargo-features = ["strip"]` to the manifest
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.Dax5TY8K3VlJ/Cargo.toml" "--target" "x86_64-unknown-linux-gnu" "-v" "-p" "std"` failed with exit code: Some(101)
0: error_chain::make_backtrace
1: <error_chain::State as core::default::Default>::default
2: <std::process::Command as xargo::extensions::CommandExt>::run
3: xargo::sysroot::build
4: xargo::sysroot::update
5: xargo::main_inner
6: std::rt::lang_start::{{closure}}
7: std::rt::lang_start_internal::{{closure}}
at /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/libstd/rt.rs:52
std::panicking::try::do_call
at /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/libstd/panicking.rs:297
std::panicking::try
at /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/libstd/panicking.rs:274
std::panic::catch_unwind
at /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/libstd/panic.rs:394
std::rt::lang_start_internal
at /rustc/a74d1862d4d87a56244958416fd05976c58ca1a8/src/libstd/rt.rs:51
8: main
9: __libc_start_main
10: _start
Example Cargo.toml
cargo-features = ["strip"]
[package]
name = "failed_case"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
[profile.release]
strip = "symbols"
and Xargo.toml
[dependencies.std]
default-features = false
features = ["panic_unwind"]
$ xargo -V
xargo 0.3.20
cargo 1.45.0-nightly (9fcb8c1d2 2020-05-25)
$ rustc -Vv
rustc 1.45.0-nightly (5fd2f06e9 2020-05-31)
binary: rustc
commit-hash: 5fd2f06e99a985dd896684cb2c9f8c7090eca1ab
commit-date: 2020-05-31
host: x86_64-unknown-linux-gnu
release: 1.45.0-nightly
LLVM version: 10.0
Yeah, xargo is only receiving critical bugfixes these days to keep existing functionality working, so I am not surprised that it does not work well with new cargo features. Sorry.