Skip to content

Commit aa4f851

Browse files
committed
Fail fast if riscv toolchain is missing
1 parent 05acb50 commit aa4f851

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ set -euo pipefail
44

55
source config.sh
66

7+
# Fail fast if these tools aren't properly installed and in the path
8+
need_cmd riscv64-unknown-elf-gcc
9+
need_cmd riscv64-unknown-elf-g++
10+
711
# Rust requires a custom target file to exist for our custom target as part of the bootstrap build,
812
# but it doesn't actually look at the contents.
913
touch /tmp/riscv32em-athena-zkvm-elf.json

config.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,26 @@ export ARTIFACT_NAME=athena-rust-toolchain-$TOOLCHAIN_HOST_TRIPLET
1717
if [ "$param1" == "-artifact_name" ]; then
1818
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
1919
fi
20+
21+
need_cmd() {
22+
if ! check_cmd "$1"; then
23+
err "need '$1' (command not found)"
24+
fi
25+
}
26+
27+
check_cmd() {
28+
command -v "$1" &>/dev/null
29+
}
30+
31+
say() {
32+
printf "rustc-rv32e-toolchain: %s\n" "$1"
33+
}
34+
35+
warn() {
36+
say "warning: ${1}" >&2
37+
}
38+
39+
err() {
40+
say "$1" >&2
41+
exit 1
42+
}

0 commit comments

Comments
 (0)