It looks like it has updated to 1.64.0, which is what I want, but then when I check the version, the update did not happen.
root#c1:~# rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: checking for self-updates
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.64.0 (a55dd71d5 2022-09-19)
info: cleaning up downloads & tmp directories
root#c1:~# rustc --version
rustc 1.58.0-nightly (072799443 2021-11-06)
that is because rustup updated a different rust installation than the one you checked its version using rustc --version.
you can see that rustup has updated a stable version of rust while rustc is nightly, as the 1st comment said. run which rustc and rustup show to locate both installations and then fix your paths accordingly
Related
I am using rustup to update the rust version, is it possible to specify the source in the command line like this?
rustup update --source http://rustup.com
I already know how to config the mirror url in .cargo/config, I just want to switch the source in temporary in the command lne. Seems no way to do this from official document:
➜ .cargo rustup update --help
rustup-update
Update Rust toolchains and rustup
USAGE:
rustup update [FLAGS] [toolchain]...
FLAGS:
--force Force an update, even if some components are missing
--force-non-host Install toolchains that require an emulator. See https://github.com/rust-
lang/rustup/wiki/Non-host-toolchains
-h, --help Prints help information
--no-self-update Don't perform self update when running the `rustup update` command
ARGS:
<toolchain>... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help
toolchain`
DISCUSSION:
With no toolchain specified, the `update` command updates each of
the installed toolchains from the official release channels, then
updates rustup itself.
If given a toolchain argument then `update` updates that
toolchain, the same as `rustup toolchain install`.
I'm trying to build the (https://github.com/betterclever/solend-anchor) package using anchor build, however I get the following error
error: package `uint v0.9.3` cannot be built because it requires rustc 1.56.1 or newer, while the currently active rustc version is 1.56.0-dev
I updated rustc and running the command rustup default nightlyshows:
info: using existing install for 'nightly-x86_64-apple-darwin'
info: default toolchain set to 'nightly-x86_64-apple-darwin'
nightly-x86_64-apple-darwin unchanged - rustc 1.61.0-nightly
So it shows me that the installed and active rustc version is 1.61, however anchor build is not finding that for some reason. I also tried running cargo build-bpf but the same thing kept happening. cargo buildseemed to work fine.
I'm wondering what is causing the problem when running anchor build and cargo build-bpf?
anchor build and cargo build-bpf use a different compiler than the normal rustc compiler included in the system, so it's normal that they report a different version. The BPF compiler comes with the Solana tool suite.
If you already have the Solana tools installed on your computer, you can simply run:
solana-install init 1.9.13
And if you don't, you can run:
sh -c "$(curl -sSfL https://release.solana.com/v1.9.13/install)"
That will give you all of the newest tools, including the BPF compiler.
I have Solana latest version, I faced the same error while compiling one of the downloaded program.
Command
solana-install update
Worked for me.
I would like to set up a toolchain override for one of my rust projects to use the GNU toolchain instead of the default MSVC one. But somehow the configuration in rust-toolchain.toml is ignored. (I am up to date it is not because of the extension.)
Here is how it goes:
λ rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\<username>\scoop\persist\rustup\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (default)
installed targets for active toolchain
--------------------------------------
x86_64-pc-windows-gnu
x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-msvc (default)
rustc 1.57.0 (f1edd0429 2021-11-29)
As you can see I have the GNU toolchain installed.
So I created the following rust-toolchain.toml file:
λ cat rust-toolchain.toml
[toolchain]
channel = "stable"
targets = ["x86_64-pc-windows-gnu"]
Now when I run rustup show I get a result showing the tool is seeing the file, but it does not seem to be processing it correctly since it still wants to use msvc.
λ rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\<username>\scoop\persist\rustup\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (default)
installed targets for active toolchain
--------------------------------------
x86_64-pc-windows-gnu
x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-msvc (overridden by 'C:\<project path>\rust-toolchain.toml')
rustc 1.57.0 (f1edd0429 2021-11-29)
My guess is that for some reason x86_64-pc-windows-gnu is considered a valid target for the stable-x86_64-pc-windows-msvc toolchain, but I do not understand why, how to prevent it, or how to write in the rust-toolchain.toml file that I want to to use the x86_64-pc-windows-gnu target of the stable-x86_64-pc-windows-gnu toolchain and not the one of the stable-x86_64-pc-windows-msvc toolchain.
How do you think I could solve this?
Note: using rustup default stable-gnu works as expected but I would like to be able to commit something in the repository so that other contributors (and their tools) know they need to use this specific toolchain.
Edit: rustup version just in case.
λ rustup -V
rustup 1.24.3 (ce5817a94 2021-05-31)
Trying to compile: https://github.com/SergioBenitez/Rocket/tree/master/examples/hello
Cargo.toml
[dependencies]
rocket = "0.4.10"
Complains that I need rust nightly
$ cargo build
...
Error: Rocket (core) requires a more recent version of rustc.
Installed version: 1.54.0 (2021-05-17)
Minimum required: 1.54.0-nightly (2021-05-18)
I have done a local directory override
$ rustup override set nightly
I am running nightly 2021-05-17 but I need 2021-05-18
$ rustup show
...
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (directory override for '/<redacted>')
rustc 1.54.0-nightly (3e99439f4 2021-05-17)
I've tried all sorts of commands to get a more recent nightly
$ rustup update
$ rustup update nightly
$ rustup toolchain install nightly-2021-05-18
There is some weird stuff when I do rustup update nightly
$ rustup update nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-23, rust version 1.54.0-nightly (e4ca1662f 2021-05-22)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-22-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-22, rust version 1.54.0-nightly (5dc8789e3 2021-05-21)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-21-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-21, rust version 1.54.0-nightly (40d230204 2021-05-20)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-20-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-20, rust version 1.54.0-nightly (f94942d84 2021-05-19)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-19-x86_64-unknown-linux-gnu'
info: latest update on 2021-05-19, rust version 1.54.0-nightly (4e3e6db01 2021-05-18)
info: skipping nightly which is missing installed component 'rls'
info: syncing channel updates for 'nightly-2021-05-18-x86_64-unknown-linux-gnu'
nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.54.0-nightly (3e99439f4 2021-05-17)
Complains about skipping nightly which is missing installed component 'rls' and I have no idea how to resolve this
Any help would be appreciated
Sorry for the wall of text, see The solution to your problem below if you only want a quick fix. You might also look at the rustup book, it contains information about this type of problem.
You are trying to install a nightly version of Rust. In nightly versions, the availability of non-essential components of Rust, such as the Rust Language Server (or short rls) is not guaranteed – if they fail to build, the nightly is shipped without them. You can see here that rls indeed was not part of the last few nightlies. The last day a nightly was shipped with rls was 2021-05-18, which is a build from the day before, so 2021-05-17 (a bit irritating, but this seems to be accepted behavior).
Your rustup installation seems to be configured to include rls. Therefore, when you tell rustup to update your nightly toolchain, rustup selects the newest nightly containing rls. There are no such nightlies newer than your currently installed nightly-2021-05-17, therefore, rustup does not update the toolchain.
The solution to your problem
If you don't need rls (it's only necessary for auto-completion in IDEs and stuff like that), there are multiple solutions to your problem:
You can remove the rls component from your nightly toolchain: rustup component remove --toolchain nightly rls
The rustup book also has some more solutions:
If [a previously installed component] is missing, rustup will automatically search for an older release that contains the required components. There are several ways to change this behavior:
Use the --force flag to rustup toolchain install to force it to install the most recent version even if there is a missing component.
Use the --profile flag to rustup toolchain install to use a different profile that does not contain the missing component. For example, --profile=minimal should always work, as the minimal set is required to exist. See the Profiles chapter for more detail.
Install a specific date that contains the components you need. For example, rustup toolchain install nightly-2020-07-27. You can then use overrides to pin to that specific release.
If you do need rls, you are in a bit of a tight spot. You might want to use a override for your project, in effect using different Rust builds for building your code and for running rls. However, this will probably not work – rls may need to build your project dependencies for autocompletion, and Rocket will not allow that with older nightlies. I don't really have a solution for this case – you may need to stay on an older version of Rocket or stop using rls for now, until there is a newer Rust nightly shipping with rls again.
I try to run
rustup update stable
and I get the following output.
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-05-07, rust version 1.43.1 (8d69840ab 2020-05-04)
error: some components unavailable for download for channel stable: 'rust-std' for target 'i386-apple-ios', 'rust-std' for target 'armv7s-apple-ios', 'rust-std' for target 'armv7-apple-ios'
If you require these components, please install and use the latest successful build version,
which you can find at <https://rust-lang.github.io/rustup-components-history>.
After determining the correct date, install it with a command such as:
rustup toolchain install nightly-2018-12-27
Then you can use the toolchain with commands such as:
cargo +nightly-2018-12-27 build
While I can install the latest stable toolchain using
rustup toolchain install stable-2020-05-07
That creates a separate toolchain.
rustup toolchain list
stable-2020-05-07-x86_64-unknown-linux-gnu (default)
stable-x86_64-unknown-linux-gnu
nightly-2020-05-07-x86_64-unknown-linux-gnu
I can use this new toolchain as the default (as I am now), but it's going to be a pain moving forward as I can't just use rustup update.
Running rustup toolchain install stable yields the same error.
How can I get the stable Rust toolchain to update via rustup update run?
The Rust team regrets to announce that Rust 1.41.0 (to be released on January 30th, 2020) will be the last release with the current level of support for 32-bit Apple targets. Starting from Rust 1.42.0, those targets will be demoted to Tier 3.
Reducing support for 32-bit Apple targets
You will need to remove those components using rustup component remove. I can't test the exact invocation, but something like:
rustup component remove --toolchain stable --target i386-apple-ios rust-std
rustup component remove --toolchain stable --target armv7s-apple-ios rust-std
rustup component remove --toolchain stable --target armv7-apple-ios rust-std
Once removed, you can update your compiler.