rustup help toolchain lists the following sub-commands
SUBCOMMANDS:
list List installed toolchains
install Install or update a given toolchain
uninstall Uninstall a toolchain
link Create a custom toolchain by symlinking to a directory
help Prints this message or the help of the given subcommand(s)
I have the following toolchains installed
stable-x86_64-unknown-linux-gnu (default)
nightly-2019-09-05-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu
master
I was trying to solve an issue for rust-clippy so I had to install the master toolchain. Even though stable is set as my default toolchain, my current toolchain is master and I would like to switch back to stable. How do I do it without uninstalling the master toolchain?
Is there no switch subcommand?
Of course the rustup default stable command works well, but the easiest way is to keep a rust-toolchain file inside your project root folder. Similar to how you'd keep a .nvm file for a Node.js project.
Please note that if you use rust-toolchain.toml instead of just rust-toolchain you will need to add needed sections similar to JSON ref and hence I prefer just the simple rust-toolchain file which doesn't need any sections similar to Node.js's .nvm file.
rust-toolchain
nightly
or
stable
Use rustup default <toolchain> to change the default toolchain. You can use the full name (e.g. rustup default stable-x86_64-unknown-linux-gnu) or a short alias (e.g. rustup default stable).
rustup also has methods to override the default in a more scoped manner. See Overrides in the rustup book.
To toggle between nightly and stable configurations in your repo use:
rustup override set nightly
or:
rustup override set stable
rustup default stable should work. This will set stable as the default toolchain globally.
To set stable as the default toolchain for just one directory/ project, use rustup override set stable command instead. To unset it, use rustup override unset.
Related
My current understanding is that stable releases are subsets of nightly (essentially with every feature flag turned off), given this is there a way to get the corresponding nightly release for a stable release?
Specifically would rustc 1.62.0-nightly (without any feature flags) have identical behavior to rustc 1.62.0?
Stable releases do not use the same code as nightly ones. Nightly releases are built off of the master branch, whereas stable releases have their own branch off of nightly with fixes backported. See also the page for how Rust's Git branching works.
The version subcommand or --version argument to most rust tools (cargo, rustc, etc) should print the git hash along with the version info, which will tell you exactly what version of the source it was built against. Additionally, stable releases are tagged in the Git repo.
I see this error in the Terminal while building a Rust application (which happens to be about NEAR Protocol, if you're curious):
error[E0463]: can't find crate for core
note: the "wasm32-unknown-unknown" target may not be installed
How can I fix it so that Rust will actually build my NEAR app?
To solve this error, run:
rustup target add wasm32-unknown-unknown
in the terminal, and that should correct the issue.
Note: I'm simply posting here as an answer what the original question asker Dorian Crutcher already wrote within their question. But that suggestion did work for me too.
I had the same problem, its reason is in an out-of-date version of Rust, the solution was to update the Rust to the latest version.
I got a similar error while trying to install universal builds of py38-cryptography via Macports on Mac OS 12.1 with an M1 Max chip.:
:info:build error[E0463]: can't find crate for `core`
:info:build |
:info:build = note: the `x86_64-apple-darwin` target may not be installed
Rebuilding Macports' installed version of rust as universal works:
sudo port install rust +universal
For future readers (mostly myself) who run into this issue, there's another important factor that could be causing this error or similar errors which is extremely hard to realize: conflicting versions of Rust and/or Cargo. This means it persists even after running rustup target add wasm32-unknown-unknown.
In my case, I had rust installed from brew and rustup at the same time, which was causing a bunch of confusion and clashes. You should make sure you have Rust installed exclusively from rustup. Double check every package manager you have on your system, because rust may have been installed as a dependency of another package, such as through cargo-nextest in my case. Such packages should be uninstalled and managed instead through cargo itself, and thus kept under the purview of rustup.
I also ran into this problem for a different reason. I had explicitly specified the version of nightly compiler to rustup as version nightly-YYYY-MM-DD, but inside a toolchain file, I only specified nightly which I suspect refers to the latest nightly for which core, among many other things, was indeed not installed.
May be somebody will help, ubuntu 20.04, just randomly found solution of next error:
error[E0463]: can't find crate for core
Run in terminal, rustup target add wasm32-unknown-unknown
Is there a way I can download the API library docs for Rust or generate them? The only docs I can find in the Rust source are in src/docs.
I'm running the nightly build, so I'm sure there's a way to generate all the docs in the same fashion as the standard docs using rustdoc, I just can't find it!
I'm running Linux, with the nightly build, using this command:
curl -s https://static.rust-lang.org/rustup.sh | sudo sh
Rustup
If you use rustup, the recommended way to install and update Rust, then the docs may already be installed; the default installation behavior has changed over time. Try running rustup doc to open them in your browser.
If they aren't already installed, you can download the docs by running rustup component add rust-docs.
By default, rustup doc opens the documentation front page, but you can add --std to jump straight to the standard API docs or --book for The Rust Programming Language. You can also use rustup doc std::iter::Iterator to open the documentation of a specific item.
rustup 1.20 learned the concept of profiles. These allow you to default to having docs installed for a toolchain (via the default profile) or not (via the minimal profile).
Standalone Rust Installer
The Rust installer also installs the documentation for the language and for Cargo. On Linux systems, it can be found at /usr/local/share/doc/{rust,cargo}.
Another way to have the Rust docs (and a few others from languages to frameworks to CLI tools) for offline use is to install Zeal for Linux or Dash for OS X and download Rust's documentation from there.
If you're running Arch, install rust-docs and navigate to file:///usr/share/doc/rust/html/index.html.
I recommend adding a link to file:///usr/local/share/doc/rust/html/index.html in your browser/desktops bookmarks.
Using the commandline installer, one can easily install Cygwin with a list of wanted packages like so
setup-x86.exe -q -p='tar,sed,<more packages>'
Is it also possible to fix the version of the packages, something like
setup-x86.exe -q -p='tar:1.2.3,sed,<more packages>'
(this obviously doesn't work)?
The short answer to your query is, No. Cygwin's setup -x86.exe does not give you the flexibility to specify version names along with package names. As per the official doc :
The basic reason for not having a more full-featured package manager is that such a program would need full access to all of Cygwin's POSIX functionality. That is, however, difficult to provide in a Cygwin-free environment, such as exists on first installation. Additionally, Windows does not easily allow overwriting of in-use executables so installing a new version of the Cygwin DLL while a package manager is using the DLL is problematic
There are however a couple of workarounds if you want to download a specific package:
Locate a cygwin mirror that hosts the specific version. Google for your version, and if you find a mirror hosting that version, simply use that mirror before running setup -x86.exe. [source]
Maintain a local pacakge repository and use the commandline options -q -L -l x:\cygwin-local\, where your downloaded package tree is in x:\cygwin-local\ [source] . You can learn how to build and maitain packages here
Compile and install the package after you've set up cygwin using make.
This is function that Cygwin's installer now provides. By default, when running from the command line, it will install the latest version of each package, but you can specify a version with =. For example:
setup-x86_64.exe -P git=2.35.0-1,vim
will install the latest version of Vim, and version 2.35.0-1 of Git.
I am trying to build cassandra cpp driver on rhel 6.4.So the requirement is to make this work on windows/RHEL with Visual Studio/gcc compiler.So what it takes to make this driver work on RHEL/windows without any additional packaging being required?
CentOS 6.4 (minimal)
1. Get the dependencies
sudo yum install gcc-c++ glibc glibc-devel boost boost-devel openssl openssl-devel libssh2 libssh2-devel zlib zlib-devel make cmake git
2. Clone the C++ driver for Cassandra from its repository
git clone https://github.com/datastax/cpp-driver.git
3. Build
cd cpp-driver
cmake -G "Unix Makefiles"
make
That's it. Most likely, the driver will be packaged sooner or later and building it will not be necessary (unless you want to hack with the dev version).
Windows
1. Get the dependencies
Install Zlib, OpenSSL, libSSH2, Boost and CMake (in this order). LibSSH2 and Boost must be compiled with Visual Studio (these processes are beyond the scope of this answer, but usually go off smoothly). Remeber the directories where you put them.
2. Download the C++ driver for Cassandra
You can clone the repository (if you have Git client at hand) or download the zipped source.
3. Configure and build
Run CMake GUI, select your toolchain, and point to the cpp-driver directory ('Where is the source code'). Hit 'Configure'. You will see some red entries that need to be set manually. Most likely these are locations of the freshly installed libraries. Set them and 'Configure' until no more red fields are present. Then hit 'Generate' and you will get an MSVS solution ready to be imported and built.
Caveats
At the time of this writing the C++ driver for Cassandra undergoes intense development. Therefore, the process described above may require appropriate tuning.
Another thing worth remembering is that (at the time of this writing) the C++ driver has only C++ interface. To preserve ABI compatibility it is advised to stick to one toolchain when building and using the driver.