Skip to content

Commit 980332b

Browse files
Proper Linux compiler support/documentation (#303)
The C++ SDK silently moved compiler requirements from GCC to Clang 21+ as of release v1.10.1, and this was never announced, properly documented, and scripts were not updated accordingly. As such, a fresh clone of this SDK on Linux did not build out of the box. This PR addresses this alongside documentation, script support, etc. Notable change overview: Compiler: gcc -> clang-21 build.sh now properly supports this. After users install the deps, this script now just works CMake minimum version: 3.20 -> 3.25 Note this was already required before this PR due to the schema version 6 usage in CMakePresets.json, just a documentation gap. All supported platforms in CI were already past this version Updates docs/building.md with relevant changes and proper dependency table
1 parent 792687a commit 980332b

18 files changed

Lines changed: 495 additions & 151 deletions

File tree

‎.github/ISSUE_TEMPLATE/bug_report.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ body:
4242
validations: { required: true }
4343
attributes:
4444
label: CMake Version
45-
description: Output of `cmake --version` (must be ≥ 3.20).
45+
description: Output of `cmake --version` (must be ≥ 3.25).
4646
placeholder: "3.28.1"
4747
- type: dropdown
4848
id: consumption

‎.github/actions/setup-sdk-deps/action.yml‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,37 @@ runs:
4343
fi
4444
sudo apt-get update
4545
sudo apt-get install -y \
46-
build-essential cmake ninja-build pkg-config \
47-
llvm-dev libclang-dev clang \
46+
build-essential cmake ninja-build pkg-config git git-lfs curl \
4847
libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \
4948
libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \
5049
libxrandr-dev libxi-dev libxkbcommon-dev \
5150
libasound2-dev libpulse-dev \
52-
libssl-dev \
53-
libprotobuf-dev protobuf-compiler \
54-
libabsl-dev \
55-
libcurl4-openssl-dev \
51+
libglib2.0-dev libssl-dev libcurl4-openssl-dev \
5652
libwayland-dev libdecor-0-dev \
53+
wget ca-certificates gnupg lsb-release \
5754
"${extra_packages[@]}"
5855
59-
# libwebrtc ships hermetic libc++ headers that require a newer clang than
60-
# Ubuntu provides. The submodule script exports CC/CXX for later steps.
61-
- name: Install clang for libwebrtc
56+
- name: Install Clang 21
6257
if: runner.os == 'Linux'
6358
shell: bash
64-
run: client-sdk-rust/.github/scripts/install-clang.sh
59+
run: |
60+
set -eux
61+
sudo install -m 0755 -d /etc/apt/keyrings
62+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
63+
| sudo tee /etc/apt/keyrings/llvm.asc >/dev/null
64+
sudo chmod a+r /etc/apt/keyrings/llvm.asc
65+
codename=$(lsb_release -cs)
66+
echo "deb [signed-by=/etc/apt/keyrings/llvm.asc] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-21 main" \
67+
| sudo tee /etc/apt/sources.list.d/llvm-21.list >/dev/null
68+
sudo apt-get update
69+
sudo apt-get install -y clang-21
70+
71+
source scripts/setup-linux-toolchain.sh
72+
{
73+
echo "CC=$CC"
74+
echo "CXX=$CXX"
75+
echo "LIBCLANG_PATH=$LIBCLANG_PATH"
76+
} >> "$GITHUB_ENV"
6577
6678
- name: Install base deps (macOS)
6779
if: runner.os == 'macOS'

‎.github/workflows/builds.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,6 @@ jobs:
157157
run: |
158158
echo "CXXFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
159159
echo "CFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
160-
LLVM_ROOT="$(dirname "${CXX}")/.."
161-
test -f "${LLVM_ROOT}/lib/libclang.so"
162-
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"
163160
164161
# ---------- Build ----------
165162
- name: Build standard SDK

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
- CMakePresets.json
4747
- build*
4848
- .build*
49+
- scripts/setup-linux-toolchain.sh
4950
- vcpkg.json
5051
- .github/workflows/ci.yml
5152
- .github/workflows/builds.yml
@@ -68,6 +69,7 @@ jobs:
6869
- cmake/**
6970
- scripts/set-test-tokens.sh
7071
- scripts/run-with-backtrace.sh
72+
- scripts/setup-linux-toolchain.sh
7173
- CMakeLists.txt
7274
- CMakePresets.json
7375
- build*

‎.github/workflows/make-release.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ jobs:
165165
run: |
166166
echo "CXXFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
167167
echo "CFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
168-
LLVM_ROOT="$(dirname "${CXX}")/.."
169-
test -f "${LLVM_ROOT}/lib/libclang.so"
170-
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"
171168
172169
# ---------- Build both variants in the same CMake tree ----------
173170
- name: Build standard SDK

‎.github/workflows/tests.yml‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,6 @@ jobs:
295295
run: |
296296
echo "CXXFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
297297
echo "CFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
298-
LLVM_ROOT="$(dirname "${CXX}")/.."
299-
test -f "${LLVM_ROOT}/lib/libclang.so"
300-
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"
301298
302299
- name: Configure Unix crash diagnostics
303300
if: runner.os != 'Windows'
@@ -585,11 +582,9 @@ jobs:
585582
# ---------- Build environment setup ----------
586583
- name: Set build environment
587584
run: |
588-
LLVM_ROOT="$(dirname "${CXX}")/.."
589-
test -f "${LLVM_ROOT}/lib/libclang.so"
590-
LLVM_COV="${LLVM_ROOT}/bin/llvm-cov"
585+
test -d "${LIBCLANG_PATH}"
586+
LLVM_COV="$(dirname "$(readlink -f "${CXX}")")/llvm-cov"
591587
test -x "${LLVM_COV}"
592-
echo "LIBCLANG_PATH=${LLVM_ROOT}/lib" >> "$GITHUB_ENV"
593588
echo "GCOV_EXECUTABLE=${LLVM_COV} gcov" >> "$GITHUB_ENV"
594589
595590
# ---------- Configure with upstream preset + coverage flag overrides ----------

‎AGENTS.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ the source tree. Track capture Rust sources and shaders in build dependencies.
145145
The build scripts pass an explicit job count to `cmake --build --parallel`. Set
146146
`CMAKE_BUILD_PARALLEL_LEVEL` to override the default detected logical CPU count.
147147

148-
**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.
148+
**Requirements:** CMake 3.25+, C++17, Rust toolchain (cargo), protoc. Linux
149+
source builds require clang/clang++ 21+ and a matching libclang runtime;
150+
`build.sh` sources `scripts/setup-linux-toolchain.sh` to discover versioned
151+
installations and validate the toolchain. Source that script before direct
152+
Linux CMake usage. The build script rejects stale build directories configured
153+
with another compiler. macOS builds use Xcode Apple Clang selected through
154+
`xcrun`. On macOS:
155+
`brew install cmake ninja protobuf abseil`. On Linux: see `docs/building.md`
156+
and the CI workflow for apt packages. spdlog is vendored automatically via
157+
FetchContent (or vcpkg on Windows) to avoid system conflicts.
149158

150159
### SDK Packaging
151160

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

369+
When a dependency is added, removed, upgraded, or used differently, update the
370+
Dependencies table in `docs/building.md` in the same change.
360371
When adding a new private/vendored dependency to this table, also add a
361372
forbidden symbol pattern for it to
362373
`.github/scripts/check_no_private_symbols.py` so the "Symbol leak check"

‎CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.20)
1+
cmake_minimum_required(VERSION 3.25)
22

33
if(NOT DEFINED LIVEKIT_VERSION OR LIVEKIT_VERSION STREQUAL "")
44
set(LIVEKIT_VERSION "0.0.0")

‎CMakePresets.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": 6,
33
"cmakeMinimumRequired": {
44
"major": 3,
5-
"minor": 20,
5+
"minor": 25,
66
"patch": 0
77
},
88
"configurePresets": [

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Use this SDK to add realtime video, audio and data features to your C++ app. By
3535

3636
## Using the SDK
3737

38-
[CMake](https://cmake.org/) (≥ 3.20) is used for building the SDK itself and for consuming it as a library. The
38+
[CMake](https://cmake.org/) (≥ 3.25) is used for building the SDK itself and for consuming it as a library. The
3939
[**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)
4040
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.
4141

0 commit comments

Comments
 (0)