Code Monkey home page Code Monkey logo

rpi-raspbian-bazel's Introduction

Bazel on Raspbian Debian Build Status

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

wget https://github.com/ochafik/rpi-raspbian-bazel/releases/download/bazel-raspbian-armv7l-0.8.0-20171130/bazel
chmod +x ./bazel
./bazel

Gives:

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" -dist.zip 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 https://github.com/samjabrahams/tensorflow-on-raspberry-pi, 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.

Usage

Download a prebuilt-image:

mkdir ~/bin && echo 'export PATH=$PATH:$HOME/bin' >> ~/.profile
wget -o ~/bin/bazel https://github.com/ochafik/rpi-raspbian-bazel/releases/download/bazel-raspbian-armv7l-0.8.0-20171130/bazel
chmod +x ~/bin/bazel

Bazel will extract its files on the first run:

bazel

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 https://github.com/ochafik/bazel -b build-from-scratch --depth=1
cd bazel
bash ./compile.sh

rpi-raspbian-bazel's People

Contributors

ochafik avatar

Stargazers

 avatar Yongtao Yao avatar Maria Romanenko avatar Timothy Spann avatar Tomokazu Katayama avatar Ming avatar

Watchers

 avatar James Cloos avatar  avatar

rpi-raspbian-bazel's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.