Ensure that you have OpenJDK 8 installed on your system.
For a system based on debian packages (e.g., Debian, Ubuntu), install
OpenJDK 8 by running the command
sudo apt-get install openjdk-8-jdk.
The standard way of compiling a release version of Bazel from source is to
use a distribution archive. Download
bazel-<VERSION>-dist.zip from the
release page for the desired
version. We recommend to also verify the signature made by our
release key 48457EE0.
Unzip the archive and call
bash ./compile.sh; this will create a bazel
output/bazel. This binary is self-contained, so it can be copied
to a directory on the PATH (such as
/usr/local/bin) or used in-place.
version 0.4.4 and below:
compile.sh may fail right after start with an error
File not found - *.jar no error prone jar
Workaround is to run this (and add it to your
version 0.4.3 and below:
compile.sh may fail fairly early with many Java
compilation errors. The errors look similar to:
C:\...\bazel_VR1HFY7x\src\com\google\devtools\build\lib\remote\ExecuteServiceGrpc.java:11: error: package io.grpc.stub does not exist import static io.grpc.stub.ServerCalls.asyncUnaryCall; ^
This is caused by a bug in one of the bootstrap scripts
scripts/bootstrap/compile.sh). Manually apply this one-line fix if you want
to build Bazel purely from source (without using an existing Bazel binary):
version 0.3.2 and below: github issue #1919