Skip to content

Commit c1470c9

Browse files
authored
Merge pull request #1550 from joshtriplett/distribution-toolchains
README: Document integration with distribution toolchains
2 parents 75f23d3 + d6786b0 commit c1470c9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,36 @@ $ rustup target add i686-pc-windows-gnu
451451
[MinGW/MSYS2 toolchain]: https://msys2.github.io/
452452
[vs]: https://www.visualstudio.com/downloads
453453

454+
## Working with distribution Rust packages
455+
456+
Several Linux distributions package Rust, and you may wish to use the packaged
457+
toolchain, such as for distribution package development. You may also wish to
458+
use a rustup-managed toolchain such as nightly or beta. Normally, rustup will
459+
complain that you already have Rust installed in /usr and refuse to install.
460+
However, you can install Rust via Rustup and have it coexist with your
461+
distribution's packaged Rust.
462+
463+
When you initially install Rust with rustup, pass the `-y` option to make it
464+
ignore the packaged Rust toolchain and install a rustup-managed toolchain into
465+
`~/.cargo/bin`. Add that directory to your `$PATH` (or let rustup do it for you
466+
by not passing `--no-modify-path`). Then, to tell rustup about your system
467+
toolchain, run:
468+
469+
```
470+
rustup toolchain link system /usr
471+
```
472+
473+
You can then use +system as a rustup toolchain, just like +nightly; for
474+
instance, you can run cargo +system build to build with the system toolchain,
475+
or cargo +nightly build to build with nightly.
476+
477+
If you do distribution Rust development, you should likely make +system your
478+
default toolchain:
479+
480+
```
481+
rustup default system
482+
```
483+
454484
## Working with custom toolchains and local builds
455485

456486
For convenience of developers working on Rust itself, `rustup` can manage

0 commit comments

Comments
 (0)