- CMake (>= 3.20)
- Rust and Cargo - For building the Rust FFI layer
- C++ Compiler
- Windows: Visual Studio 2019 or later
- Linux: GCC 9+ or Clang 10+
- macOS: Xcode 12+
This project uses different dependency management strategies per platform:
| Platform | Package Manager | Dependencies |
|---|---|---|
| Windows | vcpkg (bundled) | protobuf, abseil (DLLs included in distribution) |
| Linux | apt/dnf | libprotobuf-dev libabsl-dev libssl-dev |
| macOS | Homebrew | protobuf abseil |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
$env:VCPKG_ROOT = "$(Get-Location)"# Ubuntu/Debian
sudo apt update && sudo apt install -y \
build-essential cmake ninja-build pkg-config \
llvm-dev libclang-dev clang \
libprotobuf-dev protobuf-compiler libabsl-dev \
libssl-dev libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-devbrew install cmake ninja protobuf abseilThe project provides build.cmd (Windows) and build.sh (Linux/macOS) scripts for simplified building.
Windows:
# Set vcpkg root (required for Windows)
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
# Build Release version
.\build.cmd release
# Build Release with examples
.\build.cmd release-examples
# Build Debug version
.\build.cmd debug
# Build Debug with examples
.\build.cmd debug-examples
# Clean build artifacts
.\build.cmd clean
# Full clean (C++ + Rust + generated files)
.\build.cmd clean-allLinux:
# Install system dependencies first (see Prerequisites above)
# Build Release version
./build.sh release
# Build Release with examples
./build.sh release-examples
# Build Debug version
./build.sh debug
# Build Debug with examples
./build.sh debug-examples
# Clean build artifacts
./build.sh clean
# Full clean
./build.sh clean-allmacOS:
# Install Homebrew dependencies first (see Prerequisites above)
# Build Release version
./build.sh release
# Build Release with examples
./build.sh release-examples
# Build Debug version
./build.sh debug
# Build Debug with examples
./build.sh debug-examplesBefore building on Linux (especially Ubuntu/WSL), you may need to set environment variables to avoid common build errors.
Set Build Environment Variables:
# Suppress deprecated warnings from WebRTC (required for newer GCC versions)
export CXXFLAGS="-Wno-deprecated-declarations"
export CFLAGS="-Wno-deprecated-declarations"
# Required for Rust bindgen to find libclang
export LIBCLANG_PATH=/usr/lib/llvm-14/lib # Adjust version as neededCommon Issues:
-
Missing proto files or client-sdk-rust directory
- Solution: Initialize git submodules:
git submodule update --init --recursive
- Solution: Initialize git submodules:
-
Deprecated declaration errors during compilation
- Cause: Newer GCC versions (12/13/14) are stricter with WebRTC legacy code
- Solution: Set
CXXFLAGSandCFLAGSas shown above
-
Rust bindgen fails with "unable to find libclang"
- Cause: Rust bindgen cannot locate libclang library
- Solution: Set
LIBCLANG_PATHenvironment variable pointing to your LLVM installation
vcpkg will automatically install all required dependencies based on vcpkg.json.
Windows:
# Configure project
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake
# Build
cmake --build build --config Release
# Optional: Build with examples
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake -DLIVEKIT_BUILD_EXAMPLES=ON -DVCPKG_MANIFEST_FEATURES=examples
cmake --build build --config ReleaseLinux/macOS:
# Configure project
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
# Build
cmake --build build
# Optional: Build with examples
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DLIVEKIT_BUILD_EXAMPLES=ON -DVCPKG_MANIFEST_FEATURES=examples
cmake --build buildIf you prefer not to use vcpkg, you can install dependencies manually:
-
Protobuf (>= 5.29)
- Windows:
vcpkg install protobuf:x64-windows - Linux:
sudo apt install libprotobuf-dev protobuf-compiler - macOS:
brew install protobuf
- Windows:
-
Abseil (Required for Protobuf >= 6)
- Windows:
vcpkg install abseil:x64-windows - Linux:
sudo apt install libabsl-dev - macOS:
brew install abseil
- Windows:
-
OpenSSL (Linux only)
- Linux:
sudo apt install libssl-dev
- Linux:
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build buildAfter a successful build, you will find the following in the build directories:
build-release/ # Release build output
├── lib/
│ ├── livekit.lib / liblivekit.a # Main SDK static library
│ ├── livekit_ffi.dll / .so / .dylib # Rust FFI dynamic library
│ └── (Windows only: protobuf, abseil DLLs)
├── include/ # Public headers (auto-synced)
│ └── livekit/
└── bin/ # Example executables (with examples enabled)
├── SimpleRoom
├── SimpleRpc
├── SimpleDataStream
└── liblivekit_ffi.so / .dylib # (Linux/macOS: copied for runtime)
# Method 1: As a subdirectory
add_subdirectory(path/to/client-sdk-cpp)
target_link_libraries(your_target PRIVATE livekit)
# Method 2: Using find_package (requires prior installation)
find_package(livekit REQUIRED)
target_link_libraries(your_target PRIVATE livekit)- Add include path:
build/include - Link static library:
- Windows:
build/lib/livekit.lib - Linux:
build/lib/liblivekit.a - macOS:
build/lib/liblivekit.a
- Windows:
- Link/Deploy Rust FFI dynamic library:
- Windows: Link
livekit_ffi.dll.lib, deploylivekit_ffi.dllwith your exe - Linux: Deploy
liblivekit_ffi.soin same directory as your executable - macOS: Deploy
liblivekit_ffi.dylibin same directory as your executable
- Windows: Link
- Link platform-specific system libraries
Important: On Linux/macOS, the
.so/.dylibmust be in the same directory as your executable (RPATH is set to$ORIGIN/@executable_path).
Windows system libraries:
ntdll userenv winmm iphlpapi msdmo dmoguids wmcodecdspuuid
ws2_32 secur32 bcrypt crypt32
macOS frameworks:
CoreAudio AudioToolbox CoreFoundation Security CoreGraphics
CoreMedia VideoToolbox AVFoundation CoreVideo Foundation
AppKit QuartzCore OpenGL IOSurface Metal MetalKit ScreenCaptureKit
Linux libraries:
OpenSSL::SSL OpenSSL::Crypto
| Option | Default | Description |
|---|---|---|
LIVEKIT_BUILD_EXAMPLES |
OFF | Build example applications |
LIVEKIT_VERSION |
"0.1.0" | SDK version number |
LIVEKIT_USE_VCPKG |
ON | Use vcpkg for dependency management |
A: This has been fixed. Rust code only recompiles when Rust source files change or the Rust library doesn't exist.
A: Make sure you're using the correct CMake toolchain file:
-DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmakeA: Ensure you have OpenSSL development packages installed:
sudo apt install libssl-devA: Use the CMake-provided clean targets:
# Clean CMake build artifacts
cmake --build build --target clean
# Clean Rust build artifacts
cmake --build build --target cargo_clean
# Clean generated protobuf files
cmake --build build --target clean_generated
# Complete clean (including deletion of build directory)
cmake --build build --target clean_allExample applications are located in the examples/ directory:
- SimpleRoom - Basic room connection and audio/video handling
- SimpleRpc - RPC call examples
- SimpleDataStream - Data stream transmission examples
Please refer to the README in each example directory for more details.
- Recommended: Visual Studio 2019 or later
- Architecture: x64
- Requires macOS 12.3+ (ScreenCaptureKit support)
- Requires Xcode Command Line Tools
- Tested on: Ubuntu 20.04+
- Requires complete development toolchain
- GitHub Issues: https://github.com/livekit/client-sdk-cpp/issues
- LiveKit Documentation: https://docs.livekit.io/