Skip to content

Commit

Permalink
[setup] Install bazelisk on Ubuntu arm64 (RobotLocomotion#21201)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri authored Apr 2, 2024
1 parent bf3e8fd commit 02bc68a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
16 changes: 10 additions & 6 deletions setup/ubuntu/source_distribution/install_bazel.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Install Bazel as /usr/bin/bazel on Ubuntu.
# On Ubuntu, installs either Bazel or Bazelisk at /usr/bin/bazel.
#
# This script does not accept any command line arguments.

set -euo pipefail
Expand Down Expand Up @@ -54,17 +55,20 @@ EOF
)

# Install bazel.
# Keep this version number in sync with the drake/.bazeliskrc version number.
if [[ $(arch) = "aarch64" ]]; then
# Check if bazel is already installed.
if [[ "$(which bazel)" ]]; then
echo "Bazel is already installed." >&2
echo "Bazel(isk) is already installed." >&2
else
echo "WARNING: On Ubuntu arm64 systems, Drake's install_prereqs does not" \
"automatically install Bazel on your behalf. You will need to install" \
"Bazel yourself. See https://bazel.build for instructions." >&2
# TODO(jeremy.nimmer) Once there's a bazelisk 1.20 that incorporates pr563,
# we should switch to using that here.
dpkg_install_from_wget \
bazelisk 1.19.0-9-g58a850f \
https://drake-mirror.csail.mit.edu/github/bazelbuild/bazelisk/pr563/bazelisk_1.19.0-9-g58a850f_arm64.deb \
5501a44ba1f51298d186e4e66966b0556d03524381a967667696f032e292d719
fi
else
# Keep this version number in sync with the drake/.bazeliskrc version number.
dpkg_install_from_wget \
bazel 7.0.2 \
https://github.com/bazelbuild/bazel/releases/download/7.0.2/bazel_7.0.2-linux-x86_64.deb \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ EOF

# Prefetch the bazelisk download of bazel.
# This is especially helpful for the "Provisioned" images in CI.
(cd "${workspace_dir}" && ./third_party/com_github_bazelbuild_bazelisk/bazelisk.py version) > /dev/null
if [[ $(arch) = "aarch64" ]]; then
# Per ./install_bazel.sh, on arm we use bazelisk as our bazel so we should
# prefetch using that spelling.
cd "${workspace_dir}" && bazel version
else
# Per ./install_bazel.sh, on non-arm there is no system-wide bazelisk so we
# need to use a local copy.
cd "${workspace_dir}" && ./third_party/com_github_bazelbuild_bazelisk/bazelisk.py version
fi

0 comments on commit 02bc68a

Please sign in to comment.