Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ body:
validations: { required: true }
attributes:
label: CMake Version
description: Output of `cmake --version` (must be ≥ 3.20).
description: Output of `cmake --version` (must be ≥ 3.25).
placeholder: "3.28.1"
- type: dropdown
id: consumption
Expand Down
32 changes: 22 additions & 10 deletions .github/actions/setup-sdk-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,37 @@ runs:
fi
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ninja-build pkg-config \
llvm-dev libclang-dev clang \
build-essential cmake ninja-build pkg-config git git-lfs curl \
libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \
libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \
libxrandr-dev libxi-dev libxkbcommon-dev \
libasound2-dev libpulse-dev \
libssl-dev \
libprotobuf-dev protobuf-compiler \
libabsl-dev \
libcurl4-openssl-dev \
libglib2.0-dev libssl-dev libcurl4-openssl-dev \
libwayland-dev libdecor-0-dev \
wget ca-certificates gnupg lsb-release \
"${extra_packages[@]}"

# libwebrtc ships hermetic libc++ headers that require a newer clang than
# Ubuntu provides. The submodule script exports CC/CXX for later steps.
- name: Install clang for libwebrtc
- name: Install Clang 21
Comment thread
xianshijing-lk marked this conversation as resolved.
Resolved
if: runner.os == 'Linux'
shell: bash
run: client-sdk-rust/.github/scripts/install-clang.sh

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context: this one upstream downloads a ton more than we need, this was taking a few minutes in CI. The below list is the subset of things we need. I may advocate for moving the upstream script to do this eventually

run: |
set -eux
sudo install -m 0755 -d /etc/apt/keyrings
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
| sudo tee /etc/apt/keyrings/llvm.asc >/dev/null
sudo chmod a+r /etc/apt/keyrings/llvm.asc
codename=$(lsb_release -cs)
echo "deb [signed-by=/etc/apt/keyrings/llvm.asc] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-21 main" \
| sudo tee /etc/apt/sources.list.d/llvm-21.list >/dev/null
sudo apt-get update
sudo apt-get install -y clang-21
Comment thread
alan-george-lk marked this conversation as resolved.
Resolved

source scripts/setup-linux-toolchain.sh
{
echo "CC=$CC"
echo "CXX=$CXX"
echo "LIBCLANG_PATH=$LIBCLANG_PATH"
} >> "$GITHUB_ENV"

- name: Install base deps (macOS)
if: runner.os == 'macOS'
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ jobs:
run: |
echo "CXXFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
echo "CFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
LLVM_ROOT="$(dirname "${CXX}")/.."
test -f "${LLVM_ROOT}/lib/libclang.so"
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"

# ---------- Build ----------
- name: Build standard SDK
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
- CMakePresets.json
- build*
- .build*
- scripts/setup-linux-toolchain.sh
- vcpkg.json
- .github/workflows/ci.yml
- .github/workflows/builds.yml
Expand All @@ -68,6 +69,7 @@ jobs:
- cmake/**
- scripts/set-test-tokens.sh
- scripts/run-with-backtrace.sh
- scripts/setup-linux-toolchain.sh
- CMakeLists.txt
- CMakePresets.json
- build*
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ jobs:
run: |
echo "CXXFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
echo "CFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
LLVM_ROOT="$(dirname "${CXX}")/.."
test -f "${LLVM_ROOT}/lib/libclang.so"
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"

# ---------- Build both variants in the same CMake tree ----------
- name: Build standard SDK
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,6 @@ jobs:
run: |
echo "CXXFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
echo "CFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
LLVM_ROOT="$(dirname "${CXX}")/.."
test -f "${LLVM_ROOT}/lib/libclang.so"
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"

- name: Configure Unix crash diagnostics
if: runner.os != 'Windows'
Expand Down Expand Up @@ -585,11 +582,9 @@ jobs:
# ---------- Build environment setup ----------
- name: Set build environment
run: |
LLVM_ROOT="$(dirname "${CXX}")/.."
test -f "${LLVM_ROOT}/lib/libclang.so"
LLVM_COV="${LLVM_ROOT}/bin/llvm-cov"
test -d "${LIBCLANG_PATH}"
LLVM_COV="$(dirname "$(readlink -f "${CXX}")")/llvm-cov"
test -x "${LLVM_COV}"
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"
echo "GCOV_EXECUTABLE=${LLVM_COV} gcov" >> "$GITHUB_ENV"

# ---------- Configure with upstream preset + coverage flag overrides ----------
Expand Down
13 changes: 12 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,16 @@ the source tree. Track capture Rust sources and shaders in build dependencies.
The build scripts pass an explicit job count to `cmake --build --parallel`. Set
`CMAKE_BUILD_PARALLEL_LEVEL` to override the default detected logical CPU count.

**Requirements:** CMake 3.20+, C++17, Rust toolchain (cargo), protoc. On macOS: `brew install cmake ninja protobuf abseil`. On Linux: see the CI workflow for apt packages. spdlog is vendored automatically via FetchContent (or vcpkg on Windows) to avoid system conflicts.
**Requirements:** CMake 3.25+, C++17, Rust toolchain (cargo), protoc. Linux
Comment thread
stephen-derosa marked this conversation as resolved.
Resolved
source builds require clang/clang++ 21+ and a matching libclang runtime;
`build.sh` sources `scripts/setup-linux-toolchain.sh` to discover versioned
installations and validate the toolchain. Source that script before direct
Comment thread
stephen-derosa marked this conversation as resolved.
Resolved
Linux CMake usage. The build script rejects stale build directories configured
with another compiler. macOS builds use Xcode Apple Clang selected through
`xcrun`. On macOS:
`brew install cmake ninja protobuf abseil`. On Linux: see `docs/building.md`
and the CI workflow for apt packages. spdlog is vendored automatically via
FetchContent (or vcpkg on Windows) to avoid system conflicts.

### SDK Packaging

Expand Down Expand Up @@ -357,6 +366,8 @@ malformed table, missing `@param` on a documented function, …) fails the build
| GStreamer | Capture builds / runtime | System libraries and plugins; accessed through Rust; not redistributed in SDK bundles |
| Google Test | Test only | FetchContent in `src/tests/CMakeLists.txt` |

When a dependency is added, removed, upgraded, or used differently, update the
Dependencies table in `docs/building.md` in the same change.
When adding a new private/vendored dependency to this table, also add a
forbidden symbol pattern for it to
`.github/scripts/check_no_private_symbols.py` so the "Symbol leak check"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.25)

if(NOT DEFINED LIVEKIT_VERSION OR LIVEKIT_VERSION STREQUAL "")
set(LIVEKIT_VERSION "0.0.0")
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"minor": 25,
"patch": 0
},
"configurePresets": [
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Use this SDK to add realtime video, audio and data features to your C++ app. By

## Using the SDK

[CMake](https://cmake.org/) (≥ 3.20) is used for building the SDK itself and for consuming it as a library. The
[CMake](https://cmake.org/) (≥ 3.25) is used for building the SDK itself and for consuming it as a library. The
[**cpp-example-collection**](https://github.com/livekit-examples/cpp-example-collection) contains a reference [LiveKitSDK.cmake](https://github.com/livekit-examples/cpp-example-collection/blob/main/cmake/LiveKitSDK.cmake)
which downloads the latest stable release at CMake configure time. See [docs/building.md](docs/building.md) for additional documentation on integrating LiveKit into your project.

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/data_track_throughput/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# All paths are relative to CMAKE_CURRENT_SOURCE_DIR so this directory
# can be moved or renamed freely.

cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.25)
project(DataTrackThroughput LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/data_track_throughput/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ One row per received frame. Raw observation data only:

## Prerequisites

- CMake 3.20+
- CMake 3.25+
- C++17 compiler
- The LiveKit C++ SDK, built and installed (see below)

Expand Down
67 changes: 67 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ detect_os() {

OS_TYPE="$(detect_os)"

configure_macos_toolchain() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just want to make sure, is this needed for this linux clang thing?

or some other improvement ?

and it seems configure_macos_toolchain() unconditionally overwrites CC/CXX with the xcrun paths, whereas the Linux path honors pre-set CC/CXX (setup-linux-toolchain.sh:70-79).

@alan-george-lk alan-george-lk Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mildly related to the Linux work but not directly. We can remove this if you prefer, but the idea was given our docs callout Xcode's installation of Clang, we should do some hardening to find the toolchain in build.sh. The reason this exists is I also had a configure_linux_toolchain() function in this file, but decided to factor it out (into setup-linux-toolchain.sh as you called out) so downstream linux projects could call it out of the SDK submodule.

Happy to adjust direction here/or remove it, thoughts?

if ! command -v xcrun >/dev/null 2>&1; then
echo "ERROR: xcrun is unavailable. Install Xcode Command Line Tools." >&2
exit 1
fi

CC="$(xcrun --find clang)"
CXX="$(xcrun --find clang++)"
export CC CXX
Comment thread
alan-george-lk marked this conversation as resolved.
Resolved

echo "==> macOS compiler: $("${CXX}" --version | awk 'NR == 1 { print; exit }')"
echo "==> CC=${CC}"
echo "==> CXX=${CXX}"
}

configure_build_toolchain() {
case "${OS_TYPE}" in
linux) source "${PROJECT_ROOT}/scripts/setup-linux-toolchain.sh" ;;
macos) configure_macos_toolchain ;;
esac
}

usage() {
cat <<EOF
Usage:
Expand Down Expand Up @@ -94,6 +116,22 @@ validate_capture_value() {
done
}

canonicalize_path() {
local path="$1"
local resolved directory

if resolved="$(readlink -f "${path}" 2>/dev/null)" && [[ -n "${resolved}" ]]; then
printf '%s\n' "${resolved}"
return
fi

if directory="$(cd "$(dirname "${path}")" 2>/dev/null && pwd -P)"; then
printf '%s/%s\n' "${directory}" "$(basename "${path}")"
else
printf '%s\n' "${path}"
fi
}

parse_opts() {
shift || true
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -174,6 +212,26 @@ parse_opts() {
}

configure() {
if [[ -f "${BUILD_DIR}/CMakeCache.txt" ]]; then
local cached_cc cached_cxx selected_cc selected_cxx
cached_cc="$(awk -F= '$1 == "CMAKE_C_COMPILER:FILEPATH" { print $2; exit }' \
"${BUILD_DIR}/CMakeCache.txt")"
cached_cxx="$(awk -F= '$1 == "CMAKE_CXX_COMPILER:FILEPATH" { print $2; exit }' \
"${BUILD_DIR}/CMakeCache.txt")"
selected_cc="$(canonicalize_path "${CC}")"
selected_cxx="$(canonicalize_path "${CXX}")"
if [[ -n "${cached_cc}" && "$(canonicalize_path "${cached_cc}")" != "${selected_cc}" ]] \
|| [[ -n "${cached_cxx}" && "$(canonicalize_path "${cached_cxx}")" != "${selected_cxx}" ]]; then
echo "ERROR: ${BUILD_DIR} was configured with a different compiler:" >&2
echo " cached CC=${cached_cc}" >&2
echo " cached CXX=${cached_cxx}" >&2
echo " selected CC=${CC}" >&2
echo " selected CXX=${CXX}" >&2
echo "Run './build.sh clean' and retry." >&2
exit 1
fi
fi

echo "==> Configuring CMake (${BUILD_TYPE}) using preset ${PRESET}..."
local -a extra_args=("-DLIVEKIT_CAPTURE=${CAPTURE_OVERRIDE}")
if [[ -n "${LIVEKIT_VERSION}" ]]; then
Expand Down Expand Up @@ -351,6 +409,8 @@ clean() {
else
echo " (skipping) Unknown build system or not configured"
fi
rm -f "${debug_dir}/CMakeCache.txt"
rm -rf "${debug_dir}/CMakeFiles"
else
echo " (skipping) build-debug does not exist."
fi
Expand All @@ -365,6 +425,8 @@ clean() {
else
echo " (skipping) Unknown build system or not configured"
fi
rm -f "${release_dir}/CMakeCache.txt"
rm -rf "${release_dir}/CMakeFiles"
else
echo " (skipping) build-release does not exist."
fi
Expand Down Expand Up @@ -400,6 +462,11 @@ fi

cmd="$1"
parse_opts "$@"
case "${cmd}" in
debug|debug-examples|debug-tests|debug-all|release|release-examples|release-tests|release-all|build-all)
configure_build_toolchain
;;
esac
case "${cmd}" in
debug)
BUILD_TYPE="Debug"
Expand Down
Loading
Loading