| Author | Andy Green <andy@warmcat.com> 2026-10-03 11:03 UTC | | Committer | Andy Green <andy@warmcat.com> 2026-10-05 06:32 UTC | | Tree | b55ca8fcc6cb9e421b60dc40fd418efaacad9400 Raw Patch | | | meta: sai.sh refuses a toolchain older than rust-version, saying why | meta: sai.sh refuses a toolchain older than rust-version, saying why
On ubuntu-noble/riscv64 the job found Ubuntu's packaged cargo, 1.75,
because rustup was not installed for the builder's user. The job failed
with cargo's "`resolver` setting `3` is not valid", which does not point
at the cause: npro needs the workspace's rust-version, 1.85, the first
release to know edition 2024 and resolver 3.
sai.sh now compares rustc's version with Cargo.toml's rust-version
before running any profile. When it is missing or older, the script
stops with a message naming the version found and the version needed,
and the rustup install line from docs/sai.md. docs/sai.md says distro
packages are usually too old.
Tested here with the real 1.94 toolchain, a fake rustc reporting 1.75
(refused), one reporting exactly 1.85 (accepted), and no rustc at all
(refused).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kg5Eemy68ZaqDBcUJQG6J
|
diff --git a/docs/sai.md b/docs/sai.md
index 80f4923..d3b3631 100644
--- a/docs/sai.md
+++ b/docs/sai.md
@@ -52,6 +52,12 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profil
That gives stable with rustfmt and clippy, which is all the `test`
profile needs. Updating later is `rustup update`.
+A distro's packaged cargo is usually too old: Ubuntu noble's is 1.75, and
+npro needs the workspace's `rust-version`, 1.85, the first to know
+edition 2024. `scripts/sai.sh` checks `rustc` before anything else, and
+refuses an older one with the install command, rather than leaving cargo
+to fail parsing the manifest.
+
### The fedora44 x86_64 builder, which runs everything else
On top of the above:
diff --git a/scripts/sai.sh b/scripts/sai.sh
index ddcbde7..0c805f7 100755
--- a/scripts/sai.sh
+++ b/scripts/sai.sh
@@ -31,6 +31,19 @@ jobs="${SAI_PARALLEL:-4}"
nostd_crates="npro-core"
nostd_targets="thumbv6m-none-eabi thumbv7em-none-eabihf riscv32imc-unknown-none-elf"
+# Refuse a toolchain older than the workspace's rust-version up front: cargo
+# itself only says it cannot parse the manifest. A distro's packaged cargo
+# is the usual cause, when rustup is not installed for the builder's user.
+msrv=$(sed -n 's/^rust-version *= *"\(.*\)"/\1/p' Cargo.toml)
+have=$(rustc --version 2>/dev/null | sed -n 's/^rustc \([0-9]*\.[0-9]*\).*/\1/p')
+if [ -z "$have" ] ||
+ [ "$(printf '%s\n%s\n' "$msrv" "$have" | sort -t. -k1,1n -k2,2n | head -n1)" != "$msrv" ]; then
+ echo "rustc ${have:-not found} on this builder; npro needs $msrv or later." >&2
+ echo "Install rustup for the user sai runs jobs as, see docs/sai.md:" >&2
+ echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile default" >&2
+ exit 1
+fi
+
profile="${1:-}"
[ $# -gt 0 ] && shift
|