Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to build cargo latest with cargo latest #14071

Open
notdanilo opened this issue Jun 14, 2024 · 3 comments
Open

Failing to build cargo latest with cargo latest #14071

notdanilo opened this issue Jun 14, 2024 · 3 comments
Labels
A-rustup Area: rustup interaction C-bug Category: bug E-hard Experience: Hard S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@notdanilo
Copy link

Problem

   Compiling minimal-lexical v0.2.1
error: Unrecognized option: 'diagnostic-width'
                                                                                                                                                                                                               
error: could not compile `ff` (lib)
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo v0.82.0 (D:\dev\3rd\rust-lang\cargo)`, intermediate artifacts can be found at `D:\dev\3rd\rust-lang\cargo\target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Steps

Run this twice on cargo's repository:

  1. cargo install --debug --path . --force
  2. cargo install --debug --path . --force

Possible Solution(s)

No response

Notes

No response

Version

$ cargo version --verbose
cargo 1.79.0 (ffa9cf99a 2024-06-03)
release: 1.79.0
commit-hash: ffa9cf99a594e59032757403d4c780b46dc2c43a
commit-date: 2024-06-03
host: x86_64-pc-windows-msvc
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:Schannel)
os: Windows 10.0.22631 (Windows 11 Professional) [64-bit]
@notdanilo notdanilo added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jun 14, 2024
@heisen-li
Copy link
Contributor

@rustbot label +Command-install +A-building-cargo-itself

@rustbot rustbot added A-building-cargo-itself Area: issues with building cargo Command-install labels Jun 14, 2024
@weihanglo
Copy link
Member

This is expected, as documented in the Cargo Contributor Guide.

But when cargo is not run via rustup, the toolchain may change based on the directory. Since Cargo changes the directory for each compilation, this can cause different calls to rustc to use different versions.

You can see under ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ff-0.13.0/rust-toolchain the ff crate has a quite old MSRV. It doesn't recognize a relatively new --diagnostic-width option from rustc.

The contributor guide also provides some workaround already. Setting RUSTC or RUSTUP_TOOLCHAIN might be good alternatives.

@weihanglo weihanglo added A-rustup Area: rustup interaction and removed Command-install labels Jun 14, 2024
@weihanglo
Copy link
Member

weihanglo commented Jun 14, 2024

This is a gnarly problem that rustup and cargo are not a single binary, so Cargo doesn't know if it belongs to a toolchain. I don't think it is fixable at this moment, but leave this open for future reference.

@weihanglo weihanglo added S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. E-hard Experience: Hard and removed S-triage Status: This issue is waiting on initial triage. labels Jun 14, 2024
@epage epage removed the A-building-cargo-itself Area: issues with building cargo label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustup Area: rustup interaction C-bug Category: bug E-hard Experience: Hard S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

No branches or pull requests

5 participants