Building the Software

Ark Dependencies

First, make sure you have all of the minimum dependencies installed:

sudo apt-get install wget git xz-utils libxcb-xinerama0 libxcb-xinput0 libfreetype6 libxkbcommon0 libgl-dev libglib2.0 libegl1 libfontconfig libglapi-mesa libglu1-mesa libopengl0 python3-venv

Ark’s third-party dependencies are prebuilt (with our toolchain) and will be downloaded to the local system in the local .toolchain directory. Your system will need internet access to pull down these dependencies on your first compilation of Ark. If this is not possible, please reach out, and we can walk through installing the dependencies without an Internet connection.

Note that you can omit some things (such as the X11 libraries or Python libraries) by disabling some features of Ark (see here for build options).

You can find a list of the cmake targets for the dependencies here.

Building

You can build the software by running the following command:

./make.sh

This will automatically pull down our compiler and sysroot and then build the software in a ‘hermetic’ environment (and is largely distro-independent).

Clean Builds

There are times that one wants to delete all cached files and start from a fresh build environment.

There are 2 options one can provide as part of a make.sh command for deleting generated files:

  1. To delete the compiled build directory
./make.sh --clean
  1. To delete the build & .toolchain directories (Note - this will re-download all toolchain dependencies).
./make.sh --expunge

Common Make Flags

You can enable/disable various sanitizers with the following flags:

  • --[enable|disable]-asan - Enable/disable the address sanitizer
  • --[enable|disable]-lsan - Enable/disable the leak sanitizer
  • --[enable|disable]-tsan - Enable/disable the thread sanitizer
  • --[enable|disable]-ubsan - Enable/disable the undefine behavior sanitizer

Additionally, ccache or coverage support can be controlled with:

  • --[enable|disable]-ccache - Enable/disable ccache support
  • --[enable|disable]-coverage - Enable/disable coverage building

There are a few build-system related flags as well:

  • --build-directory [path] - Build in the specific build directory, rather than build
  • --target [architecture] - Build for the specific architecture, rather than x86/64.
  • --setup-only - Setup the build directory and then exit, don’t build.

Finally, there are a few helper flags that might be useful for day-to-day work:

  • --test-dir [path] - Run all unit tests in the given directory (recursive)
  • --test-regex [regex] - Run all unit tests that match the given regular expression
  • --run [target] - Build the given target, then execute it

Environment

You can source the env.sh file in your shell, and you will receive a number of environment variables that point to our various compilers and third party packages. This is sometimes useful when debugging.

This also allows running tools from our hermetic environment (yarn, designer, etc).

Sourcing this script is optional; typically anything that requires it will source it for you.

Exported Variables

The env.sh script exports several variables that may be useful to you:

  • ARK_ROOT - the location of the ark repo (or subrepo)
  • ARK_TOPLEVEL_REPO_ROOT - if ark is a subrepo, the location of the parent repo, otherwise, the location of the ark repo
  • ARK_HOST_RBUFC_PATH - the path to the rbufc compiler that can execute on your host architecture

Further, env.sh does set/modify variables such as CC and CXX to set the compiler to our version of clang. If you are using an older system (such as Ubuntu 18.04), this script will update your library path to include a reference to our libstdc++ build.

Building Tests

By default, all unit tests are built. You can disable this by setting the cmake variable BUILD_TESTING to OFF. See the explanation here for a full list of build system options.