|
LiveKit C++ Client SDK v1.10.0
Real-time audio/video/data SDK for C++
|
This document covers everything you need to build the LiveKit C++ SDK from source: prerequisites, cloning the repository, the build scripts, and advanced CMake/vcpkg flows.
| Platform | Compiler | Package manager |
|---|---|---|
| Windows | Visual Studio 2019+ (MSBuild or Ninja) | vcpkg (see below) |
| Linux | GCC 9+ or Clang 10+ | apt / dnf (or vcpkg) |
| macOS | Xcode 12+ (macOS 12.3+ for ScreenCaptureKit) | Homebrew (or vcpkg) |
The SDK depends on the client-sdk-rust submodule (recursive), so always clone with submodules:
These are the exact packages our CI uses. They will also work for examples.
If you plan to build the example collection (SDL-based renderer + camera/mic capture), also install:
CMake's vcpkg manifest mode (below) reads vcpkg.json and installs the rest automatically the first time you configure.
The repo ships with build.sh (Linux/macOS) and build.cmd (Windows) that wrap the right CMake preset for your platform and pick sensible defaults.
Linux/macOS:
Windows:
To create an installable SDK bundle with public headers, runtime libraries, and CMake package files, add --bundle --prefix <install-dir> to a build command:
Linux/Mac:
Windows:
The build scripts pass an explicit job count to cmake --build --parallel. Set CMAKE_BUILD_PARALLEL_LEVEL to override the auto-detected logical CPU count.
For more control, drive CMake directly via the presets in CMakePresets.json:
Windows requires VCPKG_ROOT to be set:
vcpkg will automatically install all dependencies listed in vcpkg.json the first time you configure with its toolchain file.
Windows:
Linux/macOS:
| Option | Default | Description |
|---|---|---|
LIVEKIT_BUILD_EXAMPLES | OFF | Build example applications |
LIVEKIT_USE_SYSTEM_PROTOBUF | OFF | Use system Protobuf instead of vcpkg's |
LIVEKIT_LOG_LEVEL | TRACE | Compile-time log threshold (see logging.md) |
LIVEKIT_VERSION | repo-derived | SDK version string baked into the binary |
After a successful build:
Release archives use the same layout: include/, lib/, and (on Windows) bin/. The exact build-tree layout can vary with the CMake generator.
The easiest way to consume the SDK without building from source is via the cpp-example-collection helper, which downloads a release tarball at CMake configure time:
See the example collection's LiveKitSDK.cmake for the full pattern.
Prefer the CMake package above. It provides the correct include directory and the LiveKit::livekit shared-library target. If you link a release archive manually, add its include/ directory and link only the main SDK library:
| Platform | Link-time file | Runtime files to deploy |
|---|---|---|
| Windows | lib/livekit.lib | bin/livekit.dll and bin/livekit_ffi.dll beside the application executable |
| Linux | lib/liblivekit.so | liblivekit.so and liblivekit_ffi.so in the same runtime-library directory |
| macOS | lib/liblivekit.dylib | liblivekit.dylib and liblivekit_ffi.dylib in the same runtime-library directory |
Do not link the Rust FFI library directly: livekit already records it as a shared-library dependency. On Linux, liblivekit.so uses a $ORIGIN runpath to locate liblivekit_ffi.so next to it. On macOS, it uses @loader_path for the same purpose. Your application must still be configured to find liblivekit at runtime (for example, by using an appropriate executable RPATH or platform packaging mechanism).
Official release archives bundle the two SDK libraries above. They do not bundle, or dynamically depend on, Protobuf, Abseil, or OpenSSL. As of v1.7.0:
liblivekit.so additionally depends on the system C++ runtime, glibc, and libcurl.so.4; liblivekit_ffi.so depends on the system C++ runtime and glibc. Install the matching runtime packages for your target distribution.libcurl; no Homebrew Protobuf, Abseil, or OpenSSL runtime is required.These are release-artifact requirements, not source-build prerequisites. For an updated audit of a specific release, inspect its binaries with ldd (Linux), otool -L (macOS), or dumpbin /dependents (Windows).
Initialize submodules:
Newer GCC versions (12+) are stricter with the WebRTC legacy code in the Rust submodule. If ./build.sh release errors with -Werror=deprecated-declarations, relax it for the build:
Install libclang-dev (Ubuntu) or llvm (macOS Homebrew). bindgen normally discovers libclang from the system paths once libclang-dev is installed; if not, point LIBCLANG_PATH at your LLVM's lib directory (e.g. /usr/lib/llvm-18/lib on Ubuntu 24.04).
This was a historical issue; Rust only recompiles now when Rust source files change or the Rust library is missing.
Make sure you're passing the vcpkg toolchain file:
Not currently supported via our scripts — the Visual Studio (MSBuild) CMake generator doesn't produce compile_commands.json. The Ninja generator does; see tools.md.
Or via CMake targets: