Project: Apache Heron (App Definition and Development / Streaming & Messaging)
File: compiling-overview.md

id: version-0.20.5-incubating-compiling-overview title: Compiling Heron sidebar_label: Compiling Overview original_id: compiling-overview <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> Heron is currently available for , , and . 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 , as . Instructions on running unit tests for Heron can also be found in . You must have the following installed to compile Heron: = {{% bazelVersion %}}. Later versions might work but have not been tested. See below. is required by Bazel and Heron; topologies can be written in Java 7 or above , but Heron jars are required to run with a Java 11 JRE. >= 2.6.3 >= 1.11.1 >= 3.81 >= 2.4.6 >= 4.8.1 (Linux platforms) >= 2.6.4 >= 3.8 >= 5.8.8 [Ant] (https://ant.apache.org/) >= 1.10.0 [Pkg-Config] (https://www.freedesktop.org/wiki/Software/pkg-config/) >= 0.29.2 Export the `CC` and `CXX` environment variables with a path specific to your machine: ```bash $ export CC=/your-path-to/bin/c_compiler $ export CXX=/your-path-to/bin/c++_compiler $ echo $CC $CXX ``` Heron uses the build tool. Bazel releases can be found here: https://github.com/bazelbuild/bazel/releases/tag/{{% bazelVersion %}} and installation instructions can be found . 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 %}}. There is a Python script that you can run to configure Bazel on supported platforms: ```bash $ cd /path/to/heron $ ./bazel_configure.py ``` ```bash $ 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`. ```bash $ bazel build -c opt heron/... ``` ```bash $ bazel build -c opt --copt=-O3 heron/... ``` If you wish to add the code syntax style check, add `--config=stylecheck`. 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: ```bash $ 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`. As an alternative to building a full release, you can build Heron executables for a single Heron component (such as the [Heron Tracker](user-manuals-heron-tracker-runbook)) by passing a target to the `bazel build` command. For example, the following command would build the Heron Tracker: ```bash $ bazel build heron/tools/tracker/src/python:heron-tracker ``` Instructions for running Heron unit tests can be found at [Testing Heron](compiling-running-tests).