Skip to content

Instantly share code, notes, and snippets.

@colinator
Last active August 17, 2023 13:06
Show Gist options
  • Save colinator/ff50b0aebe241cec4c1cc68bcdf64c3a to your computer and use it in GitHub Desktop.
Save colinator/ff50b0aebe241cec4c1cc68bcdf64c3a to your computer and use it in GitHub Desktop.
Install bazel on raspberry pi 4 64-bit
# Install Bazel on Raspberry pi 4, with 64-bit Raspbian
$ uname -a
Linux pi41 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
(This is mostly taken from https://www.cryptiot.de/programming/build-bazel-on-raspberry-pi/)
1. sudo raspi-config # Advanced Options -> Expand Filesystem
2. sudo nano /etc/dphys-swapfile # Set CONF_SWAPSIZE to 1024
3. sudo apt update
4. sudo apt install build-essential libatomic1 zip unzip
5. sudo apt install openjdk-11-jdk-headless
... in some directory ...
6. wget https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-dist.zip
7. unzip bazel-6.3.2-dist.zip
8. Open ~/bazel/tools/cpp/unix_cc_configure.bzl and add -latomic link flag to bazel_linkopts around line 395. Otherwise, some undefined reference to … will pop up during compilation.
9. env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh # it said that host_javabase is deprecated, but everything still worked.
10. Added the output directory to PATH.
11. Now bazel works:
$ bazel --version
bazel 6.3.2- (@non-git)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment