id: compiling-overview title: Compiling Heron sidebar_label: Compiling Overview

Heron is currently available for Mac OS X 12, Ubuntu 20.04, and debian11. This guide describes the basics of the Heron build system. For step-by-step build instructions for other platforms, the following guides are available:

Heron can be built either in its entirety, as individual components.

Instructions on running unit tests for Heron can also be found in Testing Heron.

Requirements

You must have the following installed to compile Heron:

Export the CC and CXX environment variables with a path specific to your machine:

$ export CC=/your-path-to/bin/c_compiler
$ export CXX=/your-path-to/bin/c++_compiler
$ echo $CC $CXX

Installing Bazel

Heron uses the Bazel build tool. Bazel releases can be found here: https://github.com/bazelbuild/bazel/releases/tag/{{% bazelVersion %}} and installation instructions can be found here.

To ensure that Bazel has been installed, run bazel version and check the version (listed next to Build label in the script's output) to ensure that you have Bazel {{% bazelVersion %}}.

Configuring Bazel

There is a Python script that you can run to configure Bazel on supported platforms:

$ cd /path/to/heron
$ ./bazel_configure.py

Building

$ bazel build heron/...

This will build in the Bazel default fastbuild mode. Production release packages include additional performance optimizations not enabled by default. To enable production optimizations, include the opt flag. This defaults to optimization level -O2. The second option overrides the setting to bump it to -CO3.

$ bazel build -c opt heron/...
$ bazel build -c opt --copt=-O3 heron/...

If you wish to add the code syntax style check, add --config=stylecheck.

Building All Components

The Bazel build process can produce either executable install scripts or bundled tars. To build executables or tars for all Heron components at once, use the following bazel build commands, respectively:

$ bazel build scripts/packages:binpkgs
$ bazel build scripts/packages:tarpkgs

Resulting artifacts can be found in subdirectories below the bazel-bin directory. The heron-tracker executable, for example, can be found at bazel-bin/heron/tools/tracker/src/python/heron-tracker.

Building Specific Components

As an alternative to building a full release, you can build Heron executables for a single Heron component (such as the Heron Tracker) by passing a target to the bazel build command. For example, the following command would build the Heron Tracker:

$ bazel build heron/tools/tracker/src/python:heron-tracker

Testing Heron

Instructions for running Heron unit tests can be found at Testing Heron.