Build on Windows fails to select a version of `libc` for package `test`
Closed this issue · 2 comments
Creating a new binary project, removing the content of main.rs
, adding [unstable] build-std = ["core"]
to .cargo/config.toml
, and running cargo build --target x86_64-pc-windows-msvc
on my Windows x64 machine returns the following error:
error: failed to select a version for the requirement `libc = "^0.2"`
candidate versions found which didn't match: 0.2.100, 0.2.99, 0.2.98, ...
location searched: crates.io index
required by package `test v0.0.0 (%UserProfile%\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\test)`
I checked the contents of %UserProfile%\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\test\Cargo.toml
, it has the following dependency line: libc = { version = "0.2", default-features = false }
.
Rust version: rustc 1.58.0-nightly (1f12ac872 2021-10-17)
Thanks for the report! This as also reported at rust-lang/cargo#9976, and we have identified the cause and have a fix in the works.
As a workaround, I would recommend deleting your registry cache which is located at $CARGO_HOME/registry/index
. An alternate workaround is to use a nightly before nightly-2021-10-14.
Thanks! I did not know the correct search keywords to find the ticket you mentioned, my searching skills need improvement :^)