Bazel Raspbian build script + off-the-shelf resin/rpi-raspbian Docker image derivative.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 6fd9d05 Dec 1, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore script to build docker images Nov 30, 2017
.travis.yml test on travis Nov 30, 2017
Dockerfile Update readme + scripts Nov 30, 2017 Update Dec 1, 2017 Update readme + scripts Nov 30, 2017

Bazel on Raspbian Debian Build Status

TL;DR Install bazel on your Raspberry Pi 3 w/ Raspbian "stretch" with:

chmod +x ./bazel


Extracting Bazel installation...
Usage: bazel <command> <options> ...

Available commands:
  analyze-profile     Analyzes build profile data.
  build               Builds the specified targets.

Bazel is a Open-Source build tool from Google, which is used to build projects such as TensorFlow. Which is potentially awesome (if only a bit slow) to use on your shiny new Raspberry Pi 3 (which one of these research models will be the most useful to your next maker project?).

The problem...

Edit: as pointed out in this PR, Bazel releases have a "distribution" archive zip that contains pregenerated Java artefacts for its proto files (which I overlooked in the doc).

The problem I tried to solve is to build from the git tree, not from the distribution zip (which makes it much easier).

Credits: I've spent time absorbing, who tried to solve the same issue + build Tensorflow on the Pi, but probably for an earlier version of Bazel.

Unfortunately, Raspbian doesn't have (yet) a package for Bazel. And Bazel doesn't provide (yet) a binary for armhf. And their instructions to build from source requires you use their distribution archive, ruling out git source tree as the "archive contains generated files in addition to the versioned sources, so this step cannot be short cut by checking out the source tree.".

I tried to prove this assumption wrong in ochafik/bazel (hopefully to be pulled back into the original repo), and here I'm using it to build...

Raspberry Pi binaries

I've published a pre-built binary of Bazel ~0.8.0 in the releases section of this repo.

Use at your own risk, for what I know hackers may have hijacked my Pi and planted viruses in my GCC before I compile this release.


Download a prebuilt-image:

mkdir ~/bin && echo 'export PATH=$PATH:$HOME/bin' >> ~/.profile
wget -o ~/bin/bazel
chmod +x ~/bin/bazel

Bazel will extract its files on the first run:


Building Bazel

From sources on a Raspberry Pi

Prerequisite: you'll need a large SD card (8GB at least), and the following packages:

sudo apt-get update
sudo apt-get install -y automake g++ libtool make curl git python unzip wget zip
sudo apt-get install -y oracle-java8-installer oracle-java8-set-default

# Reclaim as much space as we can: we'll need it.
sudo apt-get autoremove
sudo apt-get clean

Clone ochafik/bazel (my fork of bazelbuild/bazel) and build it:

git clone -b build-from-scratch --depth=1
cd bazel
bash ./