]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
docs: rust: quick-start: update Ubuntu instructions
authorIgor Korotin <igor.korotin@yahoo.com>
Wed, 2 Apr 2025 16:00:47 +0000 (17:00 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Thu, 22 May 2025 22:12:14 +0000 (00:12 +0200)
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 <igor.korotin@yahoo.com>
Link: https://lore.kernel.org/r/20250402160047.1827500-1-igor.korotin@yahoo.com
[ 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 <ojeda@kernel.org>
Documentation/rust/quick-start.rst

index 6d2607870ba44cf3d0a1776d7cc4f580e3a006da..155f7107329a97e89f7ebdd25529d6f8a4923ede 100644 (file)
@@ -90,15 +90,53 @@ they should generally work out of the box, e.g.::
 Ubuntu
 ******
 
-Ubuntu LTS and non-LTS (interim) releases provide recent Rust releases and thus
-they should generally work out of the box, e.g.::
+25.04
+~~~~~
+
+The latest Ubuntu releases provide recent Rust releases and thus they should
+generally work out of the box, e.g.::
+
+       apt install rustc rust-src bindgen rustfmt rust-clippy
+
+In addition, ``RUST_LIB_SRC`` needs to be set, e.g.::
+
+       RUST_LIB_SRC=/usr/src/rustc-$(rustc --version | cut -d' ' -f2)/library
+
+For convenience, ``RUST_LIB_SRC`` can be exported to the global environment.
 
-       apt install rustc-1.80 rust-1.80-src bindgen-0.65 rustfmt-1.80 rust-1.80-clippy
+
+24.04 LTS and older
+~~~~~~~~~~~~~~~~~~~
+
+Though Ubuntu 24.04 LTS and older versions still provide recent Rust
+releases, they require some additional configuration to be set, using
+the versioned packages, e.g.::
+
+       apt install rustc-1.80 rust-1.80-src bindgen-0.65 rustfmt-1.80 \
+               rust-1.80-clippy
+       ln -s /usr/lib/rust-1.80/bin/rustfmt /usr/bin/rustfmt-1.80
+       ln -s /usr/lib/rust-1.80/bin/clippy-driver /usr/bin/clippy-driver-1.80
+
+None of these packages set their tools as defaults; therefore they should be
+specified explicitly, e.g.::
+
+       make LLVM=1 RUSTC=rustc-1.80 RUSTDOC=rustdoc-1.80 RUSTFMT=rustfmt-1.80 \
+               CLIPPY_DRIVER=clippy-driver-1.80 BINDGEN=bindgen-0.65
+
+Alternatively, modify the ``PATH`` variable to place the Rust 1.80 binaries
+first and set ``bindgen`` as the default, e.g.::
+
+       PATH=/usr/lib/rust-1.80/bin:$PATH
+       update-alternatives --install /usr/bin/bindgen bindgen \
+               /usr/bin/bindgen-0.65 100
+       update-alternatives --set bindgen /usr/bin/bindgen-0.65
 
 ``RUST_LIB_SRC`` needs to be set when using the versioned packages, e.g.::
 
        RUST_LIB_SRC=/usr/src/rustc-$(rustc-1.80 --version | cut -d' ' -f2)/library
 
+For convenience, ``RUST_LIB_SRC`` can be exported to the global environment.
+
 In addition, ``bindgen-0.65`` is available in newer releases (24.04 LTS and
 24.10), but it may not be available in older ones (20.04 LTS and 22.04 LTS),
 thus ``bindgen`` may need to be built manually (please see below).