Compiler & Sysroot

At the moment, all of the code is built from a single sysroot. This contains:

  • clang 18.1.8 (and associated tools, sanitizers, tidy, etc)
  • cmake 3.29.6
  • ninja 1.11.1
  • libstdc++ (from GCC 12.2)
  • make 4.4.1
  • meson 1.3.1
  • ccache 4.6.3
  • pkgconfig 0.29.2
  • lcov 1.16

The repository is intended to be built with the above sysroot; it will likely not build without a newer libstdc++ (10.2+), at the least.

All of these are “prebuilt” and packaged into a tarball. This is pulled down and extracted the first time you build.

Top-Level Tools

  • ./make.sh - A wrapper for ninja, this builds the software.
  • ./lint.sh - Runs linting (clang-format and cmake-format).
  • ./ci/coverage.sh - Runs coverage, outputting the results in COVERAGE_REPORT
  • ./ci/tidy.sh - Runs a full build, but with clang-tidy enabled.
  • ./ci/asan.sh - Builds and runs the unit tests, with address/leak/undefined behavior sanitization enabled.
  • ./ci/tsan.sh - Builds and runs the unit tests, with thread sanitization enabled.

Additionally, the ./env.sh script should be sourced if you want to use other tools from within our hermetic environment (yarn, designer, etc).

Most scripts will source env.sh for you, if you have forgotten.

Supported Architectures

Ark will build and run on the x64, AArch64, and ARM (32-bit, HF) architectures. By default, it builds for x64.

If you want to cross-compile for AArch64 (as used in the Nvidia Jetson boards):

./make.sh --target aarch64

or if you want to cross-compile for ARM (as typically used by the Raspberry PIs):

./make.sh --target arm

Either way, that will pull down another sysroot, which contains ARM-compiled libc and libstdc++ binaries, and build the tree against that. This builds against libc 2.27, which should run on Ubuntu 18.04 and newer.

All binaries are placed in build/<architecture>-linux by default, instead of the normal build.

Passing Arguments to cmake

You can run ./make-sh --cmake-arg "ARGUMENT_TO_PASS_TO_CMAKE" if you want to pass a specific argument to the cmake binary itself (for example, enabling/disabling a variable that is not normally exposed by make.sh.

Notable Build System Options

These are options that can be configured with cmake, making minor adjustments to the build based on what your project needs.

  • ARK_EXCEPTION_STACKTRACES (default on) - Captures stacktraces when any exception is thrown, allowing you to print it out when/if desired. Capturing is relatively lightweight but does add some overhead to each exception thrown. Consider disabling if you use exceptions regularly as a control-flow mechanism.
  • ARK_LINK_BACKTRACE_EARLY (default on) - Links backtrace::backtrace to every executable in your tree by default, as the first library. Some standard libraries ship their own backtrace symbols, which will conflict with the latest versions of libbacktrace. This helps reduce that effect.
  • ARK_ENABLE_SHARED_ARK_RUNTIME (default off) - Links shared-object versions of core pieces of the Ark runtime, allowing you to dynamically link Ark. All third party symbols are hidden, allowing you to use your own third party libraries. This flag is considered experimental.
  • ARK_ENABLE_TCMALLOC (default on) - Enables capturing of some tcmalloc details and enabling some features, such as preallocation, in some libraries of Ark. Disable if you don’t intend to use tcmalloc.
  • ARK_ENABLE_QT_APPLICATIONS (default on) - Enables compilation of Qt-related libraries, applications, and plugins.
  • ARK_ENABLE_EXAMPLES (default on) - Enables compilation of example libraries and pipelines
  • ARK_ENABLE_UNIT_TESTS (default on) - Enables compilation and execution of Ark-specific unit tests.
  • ARK_ENABLE_PYTHON_STAGES (default on) - Enables compilation and linking of Python-based stages.
  • ARK_LTO (default off) - Enables ThinLTO throughout the build. To see the full benefits of this, you’ll likely need to build all of your third party dependencies with ThinLTO as well.
  • ARK_CCACHE (default off) - Enables ccache support (using the provided ccache binary). Caches your compilation results, reducing future rebuild times, at the expense of disk space.

Creating a Sysroot

You should not need to do this, but if you want, you can create your own package by running the following commands:

cd sysroot
sudo ./make_sysroot.sh

That will produce a .tar.xz file (with a hash as the filename) that has the results of your build. You can upload that to an accessible HTTP server, and then update env.sh to point to the hash of the tarball.

The next time you run make.sh (or any of the other CI tools) the toolchain will be upgraded.