Description
EDIT ehuss:
With an empty file, foo.rs
, the command rustc --emit=metadata,obj --crate-type=lib foo.rs
returns a confusing error:
error: failed to build archive: No such file or directory
The error message should at least be a little clearer. I do not know why the combination of metadata+obj causes this error. obj
by itself is fine, but for some reason adding metadata
causes an error.
Original bug report below:
Original title: Cargo check fails to build the same package that cargo build can with an unhelpful error
Problem
When running cargo check on my project, it errors out with the following error
a very unhelpful, cryptic error. Running with verbose gives no more info than i can get from this screenshot alone.
I have been able to notice that it only happens when compiling for the target thumbv7em-none-eabihf
and not my native target thumbv7em-none-eabihf
Steps
I have made a minimum example git repo
https://github.com/DusterTheFirst/cargo-check-bug-cfg-if
Possible Solution(s)
More descriptive errors than "No such file or directory" such as information about the file that is missing would help in solving the problem.
Notes
Output of cargo version
:
cargo 1.48.0-nightly (875e01232 2020-09-08)
and
cargo 1.46.0 (149022b1d 2020-07-17)
rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/dusterthefirst/.local/share/rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu
installed targets for active toolchain
--------------------------------------
thumbv7em-none-eabi
thumbv7em-none-eabihf
x86_64-unknown-linux-gnu
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (overridden by '/home/dusterthefirst/Documents/projects/rockets/avionics/viper/rust-toolchain')
rustc 1.48.0-nightly (a1947b3f9 2020-09-10)