Skip to content

Commit f7819f7

Browse files
Igor Korotinojeda
Igor Korotin
authored andcommitted
docs: rust: quick-start: update Ubuntu instructions
Split installation instructions for Ubuntu into 2 different sections: - For Ubuntu 25.04: this release provides easy-to-install Rust packages. - For Ubuntu 24.10 and below: these releases provide rust-1.80 and bindgen-0.65, which do not set their tools as defaults. The instructions for these versions have been updated to configure Rust tools properly. Signed-off-by: Igor Korotin <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Dropped 24.10 -- it is soon out of support and their `bindgen` issue (reported as issue #2086639) was never patched anyway. Removed trailing spaces. Split into subheaders. Added `rustfmt` link. Removed spurious backquotes. Reworded contents slightly. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent de7cd3e commit f7819f7

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

Documentation/rust/quick-start.rst

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,53 @@ they should generally work out of the box, e.g.::
9090
Ubuntu
9191
******
9292

93-
Ubuntu LTS and non-LTS (interim) releases provide recent Rust releases and thus
94-
they should generally work out of the box, e.g.::
93+
25.04
94+
~~~~~
95+
96+
The latest Ubuntu releases provide recent Rust releases and thus they should
97+
generally work out of the box, e.g.::
98+
99+
apt install rustc rust-src bindgen rustfmt rust-clippy
100+
101+
In addition, ``RUST_LIB_SRC`` needs to be set, e.g.::
102+
103+
RUST_LIB_SRC=/usr/src/rustc-$(rustc --version | cut -d' ' -f2)/library
104+
105+
For convenience, ``RUST_LIB_SRC`` can be exported to the global environment.
95106

96-
apt install rustc-1.80 rust-1.80-src bindgen-0.65 rustfmt-1.80 rust-1.80-clippy
107+
108+
24.04 LTS and older
109+
~~~~~~~~~~~~~~~~~~~
110+
111+
Though Ubuntu 24.04 LTS and older versions still provide recent Rust
112+
releases, they require some additional configuration to be set, using
113+
the versioned packages, e.g.::
114+
115+
apt install rustc-1.80 rust-1.80-src bindgen-0.65 rustfmt-1.80 \
116+
rust-1.80-clippy
117+
ln -s /usr/lib/rust-1.80/bin/rustfmt /usr/bin/rustfmt-1.80
118+
ln -s /usr/lib/rust-1.80/bin/clippy-driver /usr/bin/clippy-driver-1.80
119+
120+
None of these packages set their tools as defaults; therefore they should be
121+
specified explicitly, e.g.::
122+
123+
make LLVM=1 RUSTC=rustc-1.80 RUSTDOC=rustdoc-1.80 RUSTFMT=rustfmt-1.80 \
124+
CLIPPY_DRIVER=clippy-driver-1.80 BINDGEN=bindgen-0.65
125+
126+
Alternatively, modify the ``PATH`` variable to place the Rust 1.80 binaries
127+
first and set ``bindgen`` as the default, e.g.::
128+
129+
PATH=/usr/lib/rust-1.80/bin:$PATH
130+
update-alternatives --install /usr/bin/bindgen bindgen \
131+
/usr/bin/bindgen-0.65 100
132+
update-alternatives --set bindgen /usr/bin/bindgen-0.65
97133

98134
``RUST_LIB_SRC`` needs to be set when using the versioned packages, e.g.::
99135

100136
RUST_LIB_SRC=/usr/src/rustc-$(rustc-1.80 --version | cut -d' ' -f2)/library
101137

138+
For convenience, ``RUST_LIB_SRC`` can be exported to the global environment.
139+
102140
In addition, ``bindgen-0.65`` is available in newer releases (24.04 LTS and
103141
24.10), but it may not be available in older ones (20.04 LTS and 22.04 LTS),
104142
thus ``bindgen`` may need to be built manually (please see below).

0 commit comments

Comments
 (0)