Table of contents

# Building the code from source

## When is it necessary to build from source?

In most cases, you can directly run a Shasta static executable from a release build downloaded from one of the release pages, chanzuckerberg/shasta/releases for releases up to 0.10.0 or paoloshasta/shasta/releases for newer relesases. These static executables are portable to almost any version of Linux currently in use. See the quick start page for more information. You need to build from source in one of the following circumstances:

- To build a version of Shasta for which no release exists. For example, if you want to get a recently added feature not available in the most recent release build. For this specific use case, it might be easiest to instead download a Shasta test build from GitHub, as described below.
- To test, develop, or debug Shasta code.
- To port the Shasta build to a different platform.

## How to build from source

### Build platforms

We currently support building from source on the following platforms:

- Ubuntu 22.04 for Intel/AMD processors. The Shasta static executable created by this build has no dependencies (and therefore requires no installation) and runs on most current 64-bit Linux platforms that use kernel version 3.2.0 or newer.
- Ubuntu 22.04 for ARM processors (for example, AWS Graviton/Graviton2/Graviton3 processors running Ubuntu, Raspberry Pi).

Shasta no longer builds on Ubuntu 20.04 or on any version of macOS.

### Build commands

1. Check out the Shasta repository (you need to have `git` installed on your machine)

       git clone https://github.com/paoloshasta/shasta.git

2. Install prerequisite packages

       sudo shasta/scripts/InstallPrerequisites-Ubuntu.sh

3. Build

       mkdir shasta-build
       cd shasta-build
       cmake ../shasta
       make all -j
       make install

   ### Build contents

   The build process described above creates in the `shasta-build` directory a `shasta-install` directory that contains the following:

   - A `bin` directory containing the Shasta static executable, named `shasta`, Shasta shared library `shasta.so`, and several scripts. The static executable is highly portable to other Linux versions.
   - A `conf` directory containing sample config files.
   - A `docs` directory containing this and other documentation.

   ### Building smaller binaries

   If you don't plan to use your build for debugging, you can use command `make install/strip` instead of `make install` as the last step of the build process. This will strip debug symbols from the Shasta executable and shared library, which significantly reduces the size of the build directory.

   ## An alternative to building from source: downloading a test build

   Shasta uses GitHub Actions to perform a test build every time a push to the repository occurs. The main goal of these builds is to test that new code continues to build on all supported platforms, but the builds are accessible to all users for download for 90 days after their creation. The test builds are generally not as reliable as release builds and can sometimes be non-functional. With this in mind, you can use the following steps to download one of these test builds:

   - Make sure to be logged in to GitHub. Any user will work, but GitHub will not allow downloading a test build anonymously.
   - Go to the GitHub Actions page of the Shasta repository.
   - Choose a build that has green checkmark and click on it. The checkmark indicates that a push occurred at that commit, followed by a successful test build.
   - Scroll down to the Artifacts section and select what you want to download. Your browser will then download the file you selected as zipped. You can use the `unzip` command, or equivalent, to unzip it. After unzipping it, if it is an executable. Before running it, you will have to set its execute permission bit via `chmod ugo+x filename`.
   Table of contents