|
| 1 | +--- |
| 2 | +id: version-0.20.3-incubating-compiling-overview |
| 3 | +title: Compiling Heron |
| 4 | +sidebar_label: Compiling Overview |
| 5 | +original_id: compiling-overview |
| 6 | +--- |
| 7 | +<!-- |
| 8 | + Licensed to the Apache Software Foundation (ASF) under one |
| 9 | + or more contributor license agreements. See the NOTICE file |
| 10 | + distributed with this work for additional information |
| 11 | + regarding copyright ownership. The ASF licenses this file |
| 12 | + to you under the Apache License, Version 2.0 (the |
| 13 | + "License"); you may not use this file except in compliance |
| 14 | + with the License. You may obtain a copy of the License at |
| 15 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 16 | + Unless required by applicable law or agreed to in writing, |
| 17 | + software distributed under the License is distributed on an |
| 18 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 19 | + KIND, either express or implied. See the License for the |
| 20 | + specific language governing permissions and limitations |
| 21 | + under the License. |
| 22 | +--> |
| 23 | + |
| 24 | +Heron is currently available for [Mac OS X 11.01](compiling-osx), |
| 25 | +[Ubuntu 18.04](compiling-linux), and [Debian10](compiling-docker#building-heron). |
| 26 | + This guide describes the basics of the |
| 27 | +Heron build system. For step-by-step build instructions for other platforms, |
| 28 | +the following guides are available: |
| 29 | + |
| 30 | +* [Building on Linux Platforms](compiling-linux) |
| 31 | +* [Building on Mac OS X](compiling-osx) |
| 32 | + |
| 33 | +Heron can be built either [in its entirety](#building-all-components), as [individual components](#building-specific-components). |
| 34 | + |
| 35 | +Instructions on running unit tests for Heron can also be found in [Testing Heron](compiling-running-tests). |
| 36 | + |
| 37 | +## Requirements |
| 38 | + |
| 39 | +You must have the following installed to compile Heron: |
| 40 | + |
| 41 | +* [Bazel](http://bazel.io/docs/install.html) = {{% bazelVersion %}}. Later |
| 42 | + versions might work but have not been tested. See [Installing Bazel](#installing-bazel)below. |
| 43 | +* [Java 11](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) |
| 44 | + is required by Bazel and Heron; |
| 45 | + topologies can be written in Java 7 or above |
| 46 | + , but Heron jars are required to run with a Java 11 JRE. |
| 47 | +* [Autoconf](http://www.gnu.org/software/autoconf/autoconf.html) >= |
| 48 | + 2.6.3 |
| 49 | +* [Automake](https://www.gnu.org/software/automake/) >= 1.11.1 |
| 50 | +* [GNU Make](https://www.gnu.org/software/make/) >= 3.81 |
| 51 | +* [GNU Libtool](http://www.gnu.org/software/libtool/) >= 2.4.6 |
| 52 | +* [gcc/g++](https://gcc.gnu.org/) >= 4.8.1 (Linux platforms) |
| 53 | +* [CMake](https://cmake.org/) >= 2.6.4 |
| 54 | +* [Python](https://www.python.org/) >= 3.8 |
| 55 | +* [Perl](https://www.perl.org/) >= 5.8.8 |
| 56 | +* [Ant] (https://ant.apache.org/) >= 1.10.0 |
| 57 | +* [CppUnit] (https://freedesktop.org/wiki/Software/cppunit/) >= 1.10.1 |
| 58 | +* [Pkg-Config] (https://www.freedesktop.org/wiki/Software/pkg-config/) >= 0.29.2 |
| 59 | + |
| 60 | +Export the `CC` and `CXX` environment variables with a path specific to your |
| 61 | +machine: |
| 62 | + |
| 63 | +```bash |
| 64 | +$ export CC=/your-path-to/bin/c_compiler |
| 65 | +$ export CXX=/your-path-to/bin/c++_compiler |
| 66 | +$ echo $CC $CXX |
| 67 | +``` |
| 68 | + |
| 69 | +## Installing Bazel |
| 70 | + |
| 71 | +Heron uses the [Bazel](http://bazel.io) build tool. Bazel releases can be found here: |
| 72 | +https://github.com/bazelbuild/bazel/releases/tag/{{% bazelVersion %}} |
| 73 | +and installation instructions can be found [here](http://bazel.io/docs/install.html). |
| 74 | + |
| 75 | +To ensure that Bazel has been installed, run `bazel version` and check the |
| 76 | +version (listed next to `Build label` in the script's output) to ensure that you |
| 77 | +have Bazel {{% bazelVersion %}}. |
| 78 | + |
| 79 | +## Configuring Bazel |
| 80 | + |
| 81 | +There is a Python script that you can run to configure Bazel on supported |
| 82 | +platforms: |
| 83 | + |
| 84 | +```bash |
| 85 | +$ cd /path/to/heron |
| 86 | +$ ./bazel_configure.py |
| 87 | +``` |
| 88 | + |
| 89 | +## Building |
| 90 | + |
| 91 | +### Bazel OS Environments |
| 92 | + |
| 93 | +Bazel builds are specific to a given OS. When building you must specify an |
| 94 | +OS-specific configuration using the `--config` flag. The following OS values |
| 95 | +are supported: |
| 96 | + |
| 97 | +* `darwin` (Mac OS X) |
| 98 | +* `ubuntu` (Ubuntu 18.04) |
| 99 | +* `debian` (Debian10) |
| 100 | +* `centos5` (CentOS 7) |
| 101 | + |
| 102 | +For example, on Mac OS X (`darwin`), the following command will build all |
| 103 | +packages: |
| 104 | + |
| 105 | +```bash |
| 106 | +$ bazel build --config=darwin heron/... |
| 107 | +``` |
| 108 | + |
| 109 | +Production release packages include additional performance optimizations |
| 110 | +not enabled by default. Enabling these optimizations increases build time. |
| 111 | +To enable production optimizations, include the `opt` flag: |
| 112 | +```bash |
| 113 | +$ bazel build -c opt --config=PLATFORM heron/... |
| 114 | +``` |
| 115 | + |
| 116 | +### Building All Components |
| 117 | + |
| 118 | +The Bazel build process can produce either executable install scripts or |
| 119 | +bundled tars. To build executables or tars for all Heron components at once, |
| 120 | +use the following `bazel build` commands, respectively: |
| 121 | + |
| 122 | +```bash |
| 123 | +$ bazel build --config=PLATFORM scripts/packages:binpkgs |
| 124 | +$ bazel build --config=PLATFORM scripts/packages:tarpkgs |
| 125 | +``` |
| 126 | + |
| 127 | +Resulting artifacts can be found in subdirectories below the `bazel-bin` |
| 128 | +directory. The `heron-tracker` executable, for example, can be found at |
| 129 | +`bazel-bin/heron/tools/tracker/src/python/heron-tracker`. |
| 130 | + |
| 131 | +### Building Specific Components |
| 132 | + |
| 133 | +As an alternative to building a full release, you can build Heron executables |
| 134 | +for a single Heron component (such as the [Heron |
| 135 | +Tracker](user-manuals-heron-tracker-runbook)) by passing a target to the `bazel |
| 136 | +build` command. For example, the following command would build the Heron Tracker: |
| 137 | + |
| 138 | +```bash |
| 139 | +$ bazel build --config=darwin heron/tools/tracker/src/python:heron-tracker |
| 140 | +``` |
| 141 | + |
| 142 | +## Testing Heron |
| 143 | + |
| 144 | +Instructions for running Heron unit tests can be found at [Testing |
| 145 | +Heron](compiling-running-tests). |
0 commit comments