@@ -13,7 +13,17 @@ This section explains how to fetch the tools needed for building.
1313
1414Some of these requirements might be available from Linux distributions
1515under names like ``rustc ``, ``rust-src ``, ``rust-bindgen ``, etc. However,
16- at the time of writing, they are likely not to be recent enough.
16+ at the time of writing, they are likely not to be recent enough unless
17+ the distribution tracks the latest releases.
18+
19+ To easily check whether the requirements are met, the following target
20+ can be used::
21+
22+ make LLVM=1 rustavailable
23+
24+ This triggers the same logic used by Kconfig to determine whether
25+ ``RUST_IS_AVAILABLE `` should be enabled; but it also explains why not
26+ if that is the case.
1727
1828
1929rustc
@@ -26,7 +36,7 @@ Rust features.
2636If ``rustup `` is being used, enter the checked out source code directory
2737and run::
2838
29- rustup override set 1.58.0
39+ rustup override set $(scripts/min-tool-version.sh rustc)
3040
3141Otherwise, fetch a standalone installer or install ``rustup `` from:
3242
@@ -43,10 +53,19 @@ If ``rustup`` is being used, run::
4353
4454 rustup component add rust-src
4555
56+ The components are installed per toolchain, thus upgrading the Rust compiler
57+ version later on requires re-adding the component.
58+
4659Otherwise, if a standalone installer is used, the Rust repository may be cloned
4760into the installation folder of the toolchain::
4861
49- git clone --recurse-submodules https://github.com/rust-lang/rust $(rustc --print sysroot)/lib/rustlib/src/rust
62+ git clone --recurse-submodules \
63+ --branch $(scripts/min-tool-version.sh rustc) \
64+ https://github.com/rust-lang/rust \
65+ $(rustc --print sysroot)/lib/rustlib/src/rust
66+
67+ In this case, upgrading the Rust compiler version later on requires manually
68+ updating this clone.
5069
5170
5271libclang
@@ -67,8 +86,8 @@ Otherwise, building LLVM takes quite a while, but it is not a complex process:
6786
6887 https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm
6988
70- See Documentation/kbuild/llvm.rst for more information and further ways
71- to fetch pre-built releases and distribution packages.
89+ See :ref: ` Documentation/kbuild/llvm.rst < kbuild_llvm >` for more information and
90+ further ways to fetch pre-built releases and distribution packages.
7291
7392
7493bindgen
@@ -79,7 +98,7 @@ the ``bindgen`` tool. A particular version is required.
7998
8099Install it via (note that this will download and build the tool from source)::
81100
82- cargo install --locked --version 0.56.0 bindgen
101+ cargo install --locked --version $(scripts/min-tool-version.sh bindgen) bindgen
83102
84103
85104Requirements: Developing
@@ -167,8 +186,8 @@ Configuration
167186-------------
168187
169188``Rust support `` (``CONFIG_RUST ``) needs to be enabled in the ``General setup ``
170- menu. The option is only shown if the build system can locate `` rustc ``.
171- In turn, this will make visible the rest of options that depend on Rust.
189+ menu. The option is only shown if a suitable Rust toolchain is found (see
190+ above). In turn, this will make visible the rest of options that depend on Rust.
172191
173192Afterwards, go to::
174193
0 commit comments