Installing latest rust nightly complains about missing rls component
Asked Answered
I

1

11

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

Isham answered 23/5, 2021 at 2:12 Comment(0)
C
9

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.
Codycoe answered 23/5, 2021 at 11:36 Comment(4)
Thank you for the detailed answer. I managed to get around this by using rocket 0.5 directly from github which does not require nightly. However, this information will be useful if I run into issues like this in the future.Isham
When executing "rustup component remove --toolchain nightly rls", I get the following: "error: toolchain 'nightly-aarch64-apple-darwin' does not contain component 'rls' for target 'aarch64-apple-darwin'; did you mean 'rustc'?"Communard
rust-lang.github.io/rustup-components-history doesn't show rls anymore.Ravishing
@Ravishing Looks like rust-lang.github.io/rustup-components-history only shows the last 7 days. rls was last available on 2022-02-22, so it isn't visible there anymore.Codycoe

© 2022 - 2024 — McMap. All rights reserved.