rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.39k stars 2.35k forks source link

Mismatch rust version in cargo and global installation #14219

Closed chandankrishn closed 6 days ago

chandankrishn commented 3 weeks ago

Problem

solana-hello-world % cargo build-bpf error: package bumpalo v3.16.0 cannot be built because it requires rustc 1.73.0 or newer, while the currently active rustc version is 1.72.0-dev Either upgrade to rustc 1.73.0 or newer, or use cargo update -p bumpalo@3.16.0 --precise ver where ver is the latest version of bumpalo supporting rustc 1.72.0-dev solana-hello-world % rustc --version rustc 1.79.0 (129f3b996 2024-06-10) (Homebrew)

I have been running cargo build-bpf. It is showing some different version of rustc and while global rustc is different

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

No response

Muscraft commented 3 weeks ago

If I am reading this issue correctly, the problem you are running into is caused by solana, not by cargo. It looks like that issue talks about possible solutions and links to others that have potential solutions.

Skgland commented 6 days ago

The problem sounds like a confusion of the rustc version used by cargo (i.e. cargo rustc -- --version) and the version of a separately installed rustc (rust --version). Basically the rustc version used by cargo is linked to the version of cargo and has nothing to do with your seperatly installed rustc, so rather than updating your separate rustc installation you would need to update your cargo installation.

weihanglo commented 6 days ago

Thanks people. Going to close this as it doesn't seem to be an issue in Cargo. Feel free to reopen if later it is found a Cargo bug.

Skgland commented 6 days ago

Also I just noticed that you are running cargo build-bpf rather than cargo build, so it looks like this might be a similar problem to https://github.com/solana-labs/solana/issues/34987 it looks like a better error message was only implemented for build-sbf but not build-bpf or you are using an old version

Skgland commented 6 days ago

Maybe the cargo error message could be improved to indicate where the rustc it is using originates