Содержание
- Confusing error message when no default toolchain is set, and rustup is invoked as rustc or cargo #2915
- Comments
- Problem you are trying to solve
- Solution you’d like
- Notes
- [Bug]: cargo: error: no override and no default toolchain set #11177
- Comments
- Problem description
- What steps will reproduce the bug?
- What is the expected behavior?
- no override and no default toolchain set #133
- Comments
- The rustup book
- Toolchain override shorthand
- Directory overrides
- The toolchain file
- Default toolchain
- Can’t install on Ubuntu-20.04 #2450
- Comments
Problem you are trying to solve
I’m a new user (not really, but bear with me) who just installed rustup from my distribution’s repository, and don’t have a toolchain selected yet. I try to run cargo new to create my first Rust project, and see error: no override and no default toolchain set . Confusion ensues.
Solution you’d like
An error message that clearly says:
- this is an error in rustup
- the error is not unexpected
- how to resolve the error
I’d probably word it something like this:
Notes
The text was updated successfully, but these errors were encountered:
For a little more context, this is actually something a first time Rust user ran into over at #rust:matrix.org, in the context of building a Rust package for Arch Linux. The error log looked like this:
The messages prefixed ==> originate in makepkg , the package build tool, and the messages prefixed error: (except the Rustup one) originate in paru , a wrapper that automates downloading and building packages from the Arch User Repository (read: a big pile of crowdsourced build specs). The Rustup error is completely lost in the noise, and the user themselves attributed it to paru initially.
Источник
[Bug]: cargo: error: no override and no default toolchain set #11177
Problem description
This is an independent followup on #6088 and I’m also aware of #1745.
I’m currently installing home-assistant on an old Nexus 4 phone, following this guide. There’s one dependency maturin , that breaks because the rust package, toolchain or target(s) do not seem to be properly setup out of the box:
Tweaking CARGO_BUILD_TARGET accordingly, there’s some progress, but core is not found as it should:
What steps will reproduce the bug?
Get a relatively old android phone or similar arm target with Android, i.e:
Linux localhost 3.4.113-lineageos-ge3e5c40db2e #1 SMP PREEMPT Fri Jun 17 03:59:18 MSK 2022 armv7l Android
Then, install termux’s package via pkg install rust and try to pip install maturin . So, steps could be:
- pkg install rust python
- python -m venv hass
- source hass/bin/activate
- pip install maturin
- CARGO_BUILD_TARGET=arm-linux-androideabi pip install maturin
What is the expected behavior?
Ideally, after pkg install rust , Rust should have a toolchain/target installed that matches the device’s architecture.
If that’s problematic, at least rustup should work to add said architecture triplet (i.e arm-linux-androideabi ), the rustup binary doesn’t show up currently under .cargo/bin/rustup , as it should:
Источник
I was attempting to update spotify-tui but this error popped up:
I’ve set the default toolchain to stable via rustup ( rustup default stable ) but the error persists. I’m assuming I need to give rua access to something?
The text was updated successfully, but these errors were encountered:
Hi @Amanita-muscaria , this is because rua isolates your home directory where otherwise rustup cache (and default toolchain) would be stored: https://github.com/vn971/rua#safety
You can compromise isolation a bit and bind
/.cargo for it to be read-writeable (or just readable). It can be done by configuring «wrap_args», see example here: https://github.com/vn971/rua/blob/master/res/wrap_args.sh.example (or in
If you want to build fully isolated without assuming anything from HOME directory (e.g. existence of the toolchain), you can modify PKGBUILD to use code like that:
This is actually the preferred way to write AUR packages, because there are potentially many users who are not yet very familiar with Rust. They will have rustup installed, but not the stable toolchain, and thus nothing in their HOME yet.
Does that explain it / make any sense?
Ya, that makes sense. Thanks!
If you want to build fully isolated without assuming anything from HOME directory (e.g. existence of the toolchain), you can modify PKGBUILD to use code like that:
This is actually the preferred way to write AUR packages, because there are potentially many users who are not yet very familiar with Rust. They will have rustup installed, but not the stable toolchain, and thus nothing in their HOME yet.
Is this problem occurs only in Rua or in other AUR helpers too?
If you want to build fully isolated without assuming anything from HOME directory (e.g. existence of the toolchain), you can modify PKGBUILD to use code like that:
This is actually the preferred way to write AUR packages, because there are potentially many users who are not yet very familiar with Rust. They will have rustup installed, but not the stable toolchain, and thus nothing in their HOME yet.
I don’t like this. I use nightly and it forces me to download a stable branch.
@refaelsh the problem will appear in any AUR helper that does not use the fact that the user might have downloaded something to their HOME directory. Such a PKGBUILD will definitely have problems for users who didn’t do anything special about their HOME yet and are starting from scratch (let’s say, clean re-installation of the OS without any Rust commands run prior)
@Morganamilo I see your point. I would argue that a PKGBUILD should still say what it needs. E.g. whatever Rust version you need, it should be specified reproducibly in the build description, not relying that the user accidentally did what you wanted.
In the case that you’re referring to that’s really harder, because rustup on Arch does not come with any toolchain at all, by default. I’m open to other solutions as well — please share if you have any — except recommending to write PKGBUILD’s that only work if user also accidentally did something on their
Источник
The rustup book
rustup automatically determines which toolchain to use when one of the installed commands like rustc is executed. There are several ways to control and override which toolchain is used:
- A toolchain override shorthand used on the command-line, such as cargo +beta .
- The RUSTUP_TOOLCHAIN environment variable.
- A directory override, set with the rustup override command.
- The rust-toolchain.toml file.
- The default toolchain.
The toolchain is chosen in the order listed above, using the first one that is specified. There is one exception though: directory overrides and the rust-toolchain.toml file are also preferred by their proximity to the current directory. That is, these two override methods are discovered by walking up the directory tree toward the filesystem root, and a rust-toolchain.toml file that is closer to the current directory will be preferred over a directory override that is further away.
To verify which toolchain is active, you can use rustup show , which will also try to install the corresponding toolchain if the current one has not been installed according to the above rules. (Please note that this behavior is subject to change, as detailed in issue #1397.)
The rustup toolchain proxies can be instructed directly to use a specific toolchain, a convenience for developers who often test different toolchains. If the first argument to cargo , rustc or other tools in the toolchain begins with + , it will be interpreted as a rustup toolchain name, and that toolchain will be preferred, as in
Directory overrides
Directories can be assigned their own Rust toolchain with rustup override . When a directory has an override then any time rustc or cargo is run inside that directory, or one of its child directories, the override toolchain will be invoked.
To use to a specific nightly for a directory:
Or a specific stable release:
To see the active toolchain use rustup show . To remove the override and use the default toolchain again, rustup override unset .
The per-directory overrides are stored in a configuration file in rustup ‘s home directory.
Some projects find themselves ‘pinned’ to a specific release of Rust and want this information reflected in their source repository. This is most often the case for nightly-only software that pins to a revision from the release archives.
In these cases the toolchain can be named in the project’s directory in a file called rust-toolchain.toml or rust-toolchain . If both files are present in a directory, the latter is used for backwards compatibility. The files use the TOML format and have the following layout:
The [toolchain] section is mandatory, and at least one property must be specified. channel and path are mutually exclusive.
For backwards compatibility, rust-toolchain files also support a legacy format that only contains a toolchain name without any TOML encoding, e.g. just nightly-2021-01-21 . The file has to be encoded in US-ASCII in this case (if you are on Windows, check the encoding and that it does not start with a BOM). The legacy format is not available in rust-toolchain.toml files.
If you see the following error (when running rustc , cargo or other command)
it means you’re running rustup pre-1.23.0 and trying to interact with a project that uses the new TOML encoding in the rust-toolchain file. You need to upgrade rustup to 1.23.0+.
The rust-toolchain.toml / rust-toolchain files are suitable to check in to source control.
The toolchains named in these files have a more restricted form than rustup toolchains generally, and may only contain the names of the three release channels, ‘stable’, ‘beta’, ‘nightly’, Rust version numbers, like ‘1.0.0’, and optionally an archive date, like ‘nightly-2017-01-01’. They may not name custom toolchains, nor host-specific toolchains. To use a custom local toolchain, you can instead use a path toolchain:
Since a path directive directly names a local toolchain, other options like components , targets , and profile have no effect. channel and path are mutually exclusive, since a path already points to a specific toolchain. A relative path is resolved relative to the location of the rust-toolchain.toml file.
If no other overrides are set, the global default toolchain will be used. This default can be chosen when rustup is installed. The rustup default command can be used to set and query the current default. Run rustup default without any arguments to print the current default. Specify a toolchain as an argument to change the default:
Источник
Can’t install on Ubuntu-20.04 #2450
«Windows 10 2004» > WSL 2 > Ubuntu-20.04
Problem
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory located at:
This can be modified with the CARGO_HOME environment variable.
The cargo, rustc, rustup and other commands will be added to
Cargo’s bin directory, located at:
This path will then be added to your PATH environment variable by
modifying the profile files located at:
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes
- Proceed with installation (default)
- Customize installation
- Cancel installation
info: profile set to ‘default’
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for ‘stable-x86_64-unknown-linux-gnu’
info: latest update on 2020-08-03, rust version 1.45.2 (d3fb005a3 2020-07-31)
info: downloading component ‘cargo’
5.0 MiB / 5.0 MiB (100 %) 2.2 MiB/s in 2s ETA: 0s
info: downloading component ‘clippy’
2.0 MiB / 2.0 MiB (100 %) 1.8 MiB/s in 1s ETA: 0s
info: downloading component ‘rust-docs’
12.2 MiB / 12.2 MiB (100 %) 2.3 MiB/s in 6s ETA: 0s
info: downloading component ‘rust-std’
15.9 MiB / 15.9 MiB (100 %) 2.4 MiB/s in 7s ETA: 0s
info: downloading component ‘rustc’
47.1 MiB / 47.1 MiB (100 %) 2.4 MiB/s in 21s ETA: 0s
info: downloading component ‘rustfmt’
3.4 MiB / 3.4 MiB (100 %) 2.2 MiB/s in 1s ETA: 0s
info: installing component ‘cargo’
info: Defaulting to 500.0 MiB unpack ram
thread ‘main’ panicked at ‘assertion failed: (left == right)
left: 22 ,
right: 4 ‘, src/libstd/sys/unix/thread.rs:179:21
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread ‘main’ panicked at ‘assertion failed: (left == right)
left: 22 ,
right: 4 ‘, src/libstd/sys/unix/thread.rs:179:21
stack backtrace:
0: 0x7f8f800daffd — backtrace::backtrace::libunwind::trace::h812748238d609e46
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: 0x7f8f800daffd — backtrace::backtrace::trace_unsynchronized::h7c97e818aebf09c8
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: 0x7f8f800daffd — std::sys_common::backtrace::_print_fmt::h60d914263b0ccd71
at src/libstd/sys_common/backtrace.rs:78
3: 0x7f8f800daffd — ::fmt::hf78227137afc7565
at src/libstd/sys_common/backtrace.rs:59
4: 0x7f8f7fd6524c — core::fmt::write::h543cdf60775f89bf
at src/libcore/fmt/mod.rs:1069
5: 0x7f8f800da904 — std::io::Write::write_fmt::h0c7f3ce24c679426
at src/libstd/io/mod.rs:1504
6: 0x7f8f800da105 — std::sys_common::backtrace::print::h80e55e24be231368
at src/libstd/sys_common/backtrace.rs:62
7: 0x7f8f800da105 — std::sys_common::backtrace::print::h3b197b9c1261c865
at src/libstd/sys_common/backtrace.rs:49
8: 0x7f8f800da105 — std::panicking::default_hook::<>::ha6c807149ce20f8f
at src/libstd/panicking.rs:198
9: 0x7f8f800d98f4 — std::panicking::default_hook::he49a9c12e358cc45
at src/libstd/panicking.rs:218
10: 0x7f8f800d93b6 — std::panicking::rust_panic_with_hook::h93f74f5ef2f71f31
at src/libstd/panicking.rs:515
11: 0x7f8f800d9198 — rust_begin_unwind
at src/libstd/panicking.rs:419
12: 0x7f8f800d9140 — std::panicking::begin_panic_fmt::hfa6ef29ba81f400e
at src/libstd/panicking.rs:373
13: 0x7f8f80011671 — ::join::habf6ee901a47a8a4
14: 0x7f8f80010c78 — core::ptr::drop_in_place::h0b1b0dcb4b07c267
15: 0x7f8f7ff76c40 — core::ptr::drop_in_place::h09572fbec04e583f
16: 0x7f8f8002842e — rustup::dist::component: 📦 :unpack_without_first_dir::h99f4b0c2cae349ff
17: 0x7f8f7ffe559f — rustup::dist::manifestation::Manifestation::update::hacf67fad3b44f03a
18: 0x7f8f7ffd563c — rustup::dist::dist::update_from_dist::h1462627f9c58c494
19: 0x7f8f7ffd227a — rustup::install::InstallMethod::install::hbb6430b2dfaf5792
20: 0x7f8f7ffd0d21 — rustup::toolchain::DistributableToolchain::install_from_dist::h7b9bf9317c9aa2c5
21: 0x7f8f800c5aa2 — rustup::cli::self_update::install::h8ca0f61a773526a9
22: 0x7f8f800cbd3d — rustup::cli::setup_mode::main::h4d335e1871435d70
23: 0x7f8f7fcdf42a — rustup_init::main::h22da971c634937a2
24: 0x7f8f800f3e83 — std::rt::lang_start_internal::<>::<>::h4ed4ab1fb893cc93
at src/libstd/rt.rs:52
25: 0x7f8f800f3e83 — std::sys_common::backtrace::__rust_begin_short_backtrace::h1f01c818c00c4f70
at src/libstd/sys_common/backtrace.rs:130
26: 0x7f8f7fce053f — main
27: 0x7f8f7f9670b3 — __libc_start_main
28: 0x7f8f7fcdb029 —
thread panicked while panicking. aborting.
Illegal instruction (core dumped)
Notes
Output of rustup —version :
rustup 1.22.1 (b01adbb 2020-07-08)
Output of rustup show :
Default host: x86_64-unknown-linux-gnu
rustup home: /home/duglas/.rustup
no active toolchain
cargo
error: no override and no default toolchain set
🆘 Please HELP!
Best regards ✌️
The text was updated successfully, but these errors were encountered:
Источник
Ципихович Эндрю, rust идет под mingw++ или vs с++ для винды. Вам надо одно из этого чтобы было в PATH иначе раст не сможет компилировать исходники, но это не точно. Лучше всего следовать инструкции по установке rustup.
Кстати, вот почему я не люблю переводы, они неточны, а иногда и вредны, как в данном случае, ибо не дают нужную информацию. Та же ссылка на английском имеет строку
Где детально расписано как нужно ставить раст на винду.
Добавлено через 5 минут
Catstail, если что, у раста есть свой онлайн компилятор, который заточен чисто под раст и располагается на https://play.rust-lang.org/
Добавлено через 14 минут
Ципихович Эндрю, здесь есть ссылки на x86_64-pc-windows-gnu и x86_64-pc-windows-msvc в зависимости от компилятора. Не советую качать «Standalone installers» ибо он без rustup, на сколько я понял и будет неудобно обновляться до следующей версии и т.д. rustup можно представить себе как «менеджер пакетов», где в качестве пакетов выступают сборки раста (версии). Можно поставить несколько разных версий и переключаться между ними с его помощью. Ну, и, как уже говорил, — обновляться (скачивать) новые версии.
Код
$ rustup --help rustup 1.23.1 (3df2264a9 2020-11-30) The Rust toolchain installer USAGE: rustup [FLAGS] [+toolchain] <SUBCOMMAND> FLAGS: -v, --verbose Enable verbose output -q, --quiet Disable progress output -h, --help Prints help information -V, --version Prints version information ARGS: <+toolchain> release channel (e.g. +stable) or custom toolchain to set override SUBCOMMANDS: show Show the active and installed toolchains or profiles update Update Rust toolchains and rustup check Check for updates to Rust toolchains default Set the default toolchain toolchain Modify or query the installed toolchains target Modify a toolchain's supported targets component Modify a toolchain's installed components override Modify directory toolchain overrides run Run a command with an environment configured for a given toolchain which Display which binary will be run for a given command doc Open the documentation for the current toolchain man View the man page for a given command self Modify the rustup installation set Alter rustup settings completions Generate tab-completion scripts for your shell help Prints this message or the help of the given subcommand(s) DISCUSSION: rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes cross-compiling simpler with binary builds of the standard library for common platforms. If you are new to Rust consider running `rustup doc --book` to learn Rust.
Добавлено через 5 минут
Ципихович Эндрю, и ещё, у раста есть канал в дискорде где вечно море народу, в том числе разработчики. По духу он похож на обычный irsi канал, где много помощи ты получаешь именно от пользователей. Но, боюсь, в вашем случае, вы скорее всего получите ответ «читать докумментацию», если никто не отзовётся разжевать то что там и так написано.
Add Answer
|
View In TPC Matrix
Technical Problem Cluster First Answered On
November 4, 2021
Popularity
8/10
Helpfulness
10/10
Contributions From The Grepper Developer Community
Contents
Code Examples
Related Problems
TPC Matrix View Full Screen
error: no override and no default toolchain set
Comments(1)
6
Popularity
8/10 Helpfulness
10/10
Language
whatever
Source: Grepper
Tags: default
set
toolchain
whatever
Contributed on Nov 04 2021
CharllierJr
80 Answers Avg Quality 8/10
Grepper
Features
Reviews
Code Answers
Search Code Snippets
Plans & Pricing
FAQ
Welcome
Browsers Supported
Grepper Teams
Documentation
Adding a Code Snippet
Viewing & Copying Snippets
Social
Legal
Privacy Policy
Terms
Contact
support@codegrepper.com
The rustup book
Overrides
rustup
automatically determines which toolchain to use when one of the
installed commands like rustc
is executed. There are several ways to control
and override which toolchain is used:
- A toolchain override shorthand used on the command-line, such as
cargo +beta
. - The
RUSTUP_TOOLCHAIN
environment variable. - A directory override, set with the
rustup override
command. - The
rust-toolchain.toml
file. - The default toolchain.
The toolchain is chosen in the order listed above, using the first one that is
specified. There is one exception though: directory overrides and the
rust-toolchain.toml
file are also preferred by their proximity to the current
directory. That is, these two override methods are discovered by walking up
the directory tree toward the filesystem root, and a rust-toolchain.toml
file
that is closer to the current directory will be preferred over a directory
override that is further away.
To verify which toolchain is active, you can use rustup show
,
which will also try to install the corresponding
toolchain if the current one has not been installed according to the above rules.
(Please note that this behavior is subject to change, as detailed in issue #1397.)
Toolchain override shorthand
The rustup
toolchain proxies can be instructed directly to use a specific
toolchain, a convenience for developers who often test different toolchains.
If the first argument to cargo
, rustc
or other tools in the toolchain
begins with +
, it will be interpreted as a rustup
toolchain name, and that
toolchain will be preferred, as in
cargo +beta test
Directory overrides
Directories can be assigned their own Rust toolchain with rustup override
.
When a directory has an override then any time rustc
or cargo
is run
inside that directory, or one of its child directories, the override toolchain
will be invoked.
To use to a specific nightly for a directory:
rustup override set nightly-2014-12-18
Or a specific stable release:
rustup override set 1.0.0
To see the active toolchain use rustup show
. To remove the override and use
the default toolchain again, rustup override unset
.
The per-directory overrides are stored in a configuration file in rustup
‘s
home directory.
The toolchain file
Some projects find themselves ‘pinned’ to a specific release of Rust and want
this information reflected in their source repository. This is most often the
case for nightly-only software that pins to a revision from the release
archives.
In these cases the toolchain can be named in the project’s directory in a file
called rust-toolchain.toml
or rust-toolchain
. If both files are present in
a directory, the latter is used for backwards compatibility. The files use the
TOML format and have the following layout:
[toolchain]
channel = "nightly-2020-07-10"
components = [ "rustfmt", "rustc-dev" ]
targets = [ "wasm32-unknown-unknown", "thumbv2-none-eabi" ]
profile = "minimal"
The [toolchain]
section is mandatory, and at least one property must be
specified. channel
and path
are mutually exclusive.
For backwards compatibility, rust-toolchain
files also support a legacy
format that only contains a toolchain name without any TOML encoding, e.g.
just nightly-2021-01-21
. The file has to be encoded in US-ASCII in this case
(if you are on Windows, check the encoding and that it does not start with a
BOM). The legacy format is not available in rust-toolchain.toml
files.
If you see the following error (when running rustc
, cargo
or other command)
error: invalid channel name '[toolchain]' in '/PATH/TO/DIRECTORY/rust-toolchain'
it means you’re running rustup
pre-1.23.0 and trying to interact with a project
that uses the new TOML encoding in the rust-toolchain
file. You need to upgrade
rustup
to 1.23.0+.
The rust-toolchain.toml
/rust-toolchain
files are suitable to check in to
source control.
The toolchains named in these files have a more restricted form than rustup
toolchains generally, and may only contain the names of the three release
channels, ‘stable’, ‘beta’, ‘nightly’, Rust version numbers, like ‘1.0.0’, and
optionally an archive date, like ‘nightly-2017-01-01’. They may not name
custom toolchains, nor host-specific toolchains. To use a custom local
toolchain, you can instead use a path
toolchain:
[toolchain]
path = "/path/to/local/toolchain"
Since a path
directive directly names a local toolchain, other options
like components
, targets
, and profile
have no effect. channel
and path
are mutually exclusive, since a path
already points to a
specific toolchain. A relative path
is resolved relative to the
location of the rust-toolchain.toml
file.
Default toolchain
If no other overrides are set, the global default toolchain will be used. This
default can be chosen when rustup
is installed. The rustup default
command can be used to set and query the current default. Run rustup default
without any arguments to print the current default. Specify a toolchain as an
argument to change the default:
rustup default nightly-2020-07-27