Dependencies Required to Build librav1e
Building the librav1e library from source allows you to
utilize the latest features and performance optimizations of the rav1e
AV1 video encoder. To successfully compile the project, you must install
several critical build tools, including the Rust toolchain, an assembler
for hardware-specific optimizations, and the cargo-c generator for
C-library compatibility. This article provides a direct, step-by-step
checklist of these primary dependencies.
1. The Rust Toolchain
Because rav1e is written in Rust, the Rust compiler and its package manager are the most critical requirements. * rustc: The Rust compiler. It is highly recommended to use the latest stable version. * cargo: The Rust package manager used to download dependencies and orchestrate the build.
You can install and manage both tools using the official installer,
rustup.
2. Assembly Compiler (NASM)
To achieve viable encoding speeds, rav1e relies on hand-written assembly code for x86-64 CPU architectures. * NASM (Netwide Assembler): Version 2.14 or newer is required to compile these assembly optimizations.
If NASM is missing or outdated, the build process will either fail or compile a significantly slower, reference-only version of the encoder.
3. Cargo-C (For C/C++ API Integration)
If your goal is to build librav1e as a C-compatible
shared or static library (which is typically required to link rav1e with
external applications like FFmpeg or HandBrake), you must install the
cargo-c helper utility. * cargo-c: This
tool compiles the Rust crate into a standard C library format,
generating the necessary .h header files,
.so/.dylib/.dll binaries, and
.pc (pkg-config) files. It can be installed by running:
cargo install cargo-c
4. System Build Tools and Linkers
Standard system build utilities are required to link the compiled
libraries and manage build environments: * C Compiler:
A toolchain such as gcc or clang is required
on Linux/macOS, or MSVC on Windows. * pkg-config:
Required on Unix-like systems to manage library paths and helper
metadata. * git: Needed to clone the official rav1e
source code repository.