Building From Source

In addition to meeting the system requirements, there are two things you need to build RTRTR: a C toolchain and Rust. You can run RTRTR on any operating system and CPU architecture where you can fulfil these requirements.

Dependencies

C Toolchain

Some of the libraries RTRTR depends on require a C toolchain to be present. Your system probably has some easy way to install the minimum set of packages to build from C sources. For example, this command will install everything you need on Debian/Ubuntu:

apt install build-essential

If you are unsure, try to run cc on a command line. If there is a complaint about missing input files, you are probably good to go.

Rust

The Rust compiler runs on, and compiles to, a great number of platforms, though not all of them are equally supported. The official Rust Platform Support page provides an overview of the various support levels.

While some system distributions include Rust as system packages, RTRTR relies on a relatively new version of Rust, currently 1.52 or newer. We therefore suggest to use the canonical Rust installation via a tool called rustup.

Assuming you already have curl installed, you can install rustup and Rust by simply entering:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Alternatively, visit the Rust website for other installation methods.

Building and Updating

In Rust, a library or executable program such as RTRTR is called a crate. Crates are published on crates.io, the Rust package registry. Cargo is the Rust package manager. It is a tool that allows Rust packages to declare their various dependencies and ensure that you’ll always get a repeatable build.

Cargo fetches and builds RTRTR’s dependencies into an executable binary for your platform. By default you install from crates.io, but you can for example also install from a specific Git URL, as explained below.

Installing the latest RTRTR release from crates.io is as simple as running:

cargo install --locked rtrtr

The command will build RTRTR and install it in the same directory that Cargo itself lives in, likely $HOME/.cargo/bin. This means RTRTR will be in your path, too.

Updating

If you want to update to the latest version of RTRTR, it’s recommended to update Rust itself as well, using:

rustup update

Use the --force option to overwrite an existing version with the latest RTRTR release:

cargo install --locked --force rtrtr

Once RTRTR is installed, you need to create a Configuration file that suits your needs. The config file to use needs to be passed to RTRTR via the -c option, i.e.:

rtrtr -c rtrtr.conf

Installing Specific Versions

If you want to install a specific version of RTRTR using Cargo, explicitly use the --version option. If needed, use the --force option to overwrite an existing version:

cargo install --locked --force rtrtr --version 0.2.0-rc2

All new features of RTRTR are built on a branch and merged via a pull request, allowing you to easily try them out using Cargo. If you want to try a specific branch from the repository you can use the --git and --branch options:

cargo install --git https://github.com/NLnetLabs/rtrtr.git --branch main

See also

For more installation options refer to the Cargo book.

Platform Specific Instructions

For some platforms, rustup cannot provide binary releases to install directly. The Rust Platform Support page lists several platforms where official binary releases are not available, but Rust is still guaranteed to build. For these platforms, automated tests are not run so it’s not guaranteed to produce a working build, but they often work to quite a good degree.

OpenBSD

On OpenBSD, patches are required to get Rust running correctly, but these are well maintained and offer the latest version of Rust quite quickly.

Rust can be installed on OpenBSD by running:

pkg_add rust

CentOS 6

The standard installation method does not work when using CentOS 6. Here, you will end up with a long list of error messages about missing assembler instructions. This is because the assembler shipped with CentOS 6 is too old.

You can get the necessary version by installing the Developer Toolset 6 from the Software Collections repository. On a virgin system, you can install Rust using these steps:

sudo yum install centos-release-scl
sudo yum install devtoolset-6
scl enable devtoolset-6 bash
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env