i think this can help also: Wrong Solana version the error is du to anchor using cargo and rustc from within your Solana release not rustup update toolchains...
One thing that worked was opening corgo.lock file and putting a "3" in version instead of 4.... It will compile but you'll run into a rusc or cargo using 1.79 but you are using 1.75... Rustup update won't fix that as i said it uses rust from within solana...
To fix both errors
just update your bsolana cli --version to a 2.1.x version just go take a look at the different solana-program versions and rust version at crates.io... you can go chexk out solana-program versions and rust requierments here:
solana-program@=>2.1.0
using rust crates, its best to match all basiv solana instances to same version and also to use the same cli version ex: solana-program: 2.1.11 solana-sdk: 2.1.11, solana-???? 2.1.11 all the same.
Then update your solana using:
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
just replace /stable with v^2.1.0 or any version above 2.1.x
Then if you run into dependencies problems use the same crates.io link and search for crate or dependency and look at its dependencies and match.. Generally cargo add fetches the right version if no entry is present...