Skip to content

Commit 2bb8e13

Browse files
Fix capture CI dependencies and Windows Cargo path lengths
1 parent 2a98849 commit 2bb8e13

7 files changed

Lines changed: 75 additions & 17 deletions

File tree

‎.github/actions/setup-capture/action.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ runs:
88
shell: bash
99
run: |
1010
sudo apt-get update
11-
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
11+
# Request the distro unwinder explicitly so apt can replace conflicting
12+
# LLVM unwinder development packages on Ubuntu 22.04 runners.
13+
sudo apt-get install -y libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
1214
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
1315
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav
1416
- name: Install GStreamer (macOS)

‎.github/workflows/builds.yml‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ jobs:
103103
runs-on: ${{ matrix.os }}
104104

105105
steps:
106+
- name: Set Cargo output root
107+
shell: bash
108+
run: |
109+
if [[ "$RUNNER_OS" == "Windows" ]]; then
110+
echo "CARGO_TARGET_DIR=$(cygpath -m "$RUNNER_TEMP")/lk-rust" >> "$GITHUB_ENV"
111+
else
112+
echo "CARGO_TARGET_DIR=$GITHUB_WORKSPACE/client-sdk-rust/target" >> "$GITHUB_ENV"
113+
fi
114+
106115
- name: Checkout (with submodules)
107116
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
108117
with:
@@ -222,17 +231,19 @@ jobs:
222231
id: cache-cargo-target
223232
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
224233
with:
225-
path: client-sdk-rust/target/
226-
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-${{ steps.rust_sha.outputs.sha }}
234+
path: |
235+
client-sdk-rust/target/
236+
${{ env.CARGO_TARGET_DIR }}
237+
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-${{ steps.rust_sha.outputs.sha }}
227238
restore-keys: |
228-
${{ matrix.os }}-${{ matrix.name }}-cargo-target-
239+
${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-
229240
230241
# restore-keys can hydrate target/ from a prior submodule SHA. cxxbridge
231242
# artifacts in webrtc-sys are not compatible across those bumps.
232243
- name: Drop stale cargo target on submodule SHA cache miss
233244
if: steps.cache-cargo-target.outputs.cache-hit != 'true'
234245
shell: bash
235-
run: rm -rf client-sdk-rust/target/
246+
run: rm -rf client-sdk-rust/target/ "$CARGO_TARGET_DIR"
236247

237248
# ---------- Build environment setup ----------
238249
- name: Set Linux build environment
@@ -265,8 +276,10 @@ jobs:
265276
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.cache-cargo-target.outputs.cache-hit != 'true'
266277
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
267278
with:
268-
path: client-sdk-rust/target/
269-
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-${{ steps.rust_sha.outputs.sha }}
279+
path: |
280+
client-sdk-rust/target/
281+
${{ env.CARGO_TARGET_DIR }}
282+
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-${{ steps.rust_sha.outputs.sha }}
270283

271284
- name: Save vcpkg binary cache
272285
if: runner.os == 'Windows' && steps.cache-vcpkg-binary.outputs.cache-hit != 'true'

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ jobs:
8484
runs-on: ${{ matrix.os }}
8585

8686
steps:
87+
- name: Set Cargo output root
88+
shell: bash
89+
run: |
90+
if [[ "$RUNNER_OS" == "Windows" ]]; then
91+
echo "CARGO_TARGET_DIR=$(cygpath -m "$RUNNER_TEMP")/lk-rust" >> "$GITHUB_ENV"
92+
else
93+
echo "CARGO_TARGET_DIR=$GITHUB_WORKSPACE/client-sdk-rust/target" >> "$GITHUB_ENV"
94+
fi
95+
8796
- name: Checkout (with submodules)
8897
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
8998
with:
@@ -214,17 +223,19 @@ jobs:
214223
id: cache-cargo-target
215224
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
216225
with:
217-
path: client-sdk-rust/target/
218-
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-${{ steps.rust_sha.outputs.sha }}
226+
path: |
227+
client-sdk-rust/target/
228+
${{ env.CARGO_TARGET_DIR }}
229+
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-${{ steps.rust_sha.outputs.sha }}
219230
restore-keys: |
220-
${{ matrix.os }}-${{ matrix.name }}-cargo-target-
231+
${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-
221232
222233
# restore-keys can hydrate target/ from a prior submodule SHA. cxxbridge
223234
# artifacts in webrtc-sys are not compatible across those bumps.
224235
- name: Drop stale cargo target on submodule SHA cache miss
225236
if: steps.cache-cargo-target.outputs.cache-hit != 'true'
226237
shell: bash
227-
run: rm -rf client-sdk-rust/target/
238+
run: rm -rf client-sdk-rust/target/ "$CARGO_TARGET_DIR"
228239

229240
# ---------- Build environment setup ----------
230241
- name: Set Linux build environment

‎.github/workflows/tests.yml‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ jobs:
174174
BUILD_DIR: ${{ inputs.build_type == 'debug' && 'build-debug' || 'build-release' }}
175175

176176
steps:
177+
- name: Set Cargo output root
178+
shell: bash
179+
run: |
180+
if [[ "$RUNNER_OS" == "Windows" ]]; then
181+
echo "CARGO_TARGET_DIR=$(cygpath -m "$RUNNER_TEMP")/lk-rust" >> "$GITHUB_ENV"
182+
else
183+
echo "CARGO_TARGET_DIR=$GITHUB_WORKSPACE/client-sdk-rust/target" >> "$GITHUB_ENV"
184+
fi
185+
177186
- name: Checkout (with submodules)
178187
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
179188
with:
@@ -319,17 +328,19 @@ jobs:
319328
id: cache-cargo-target
320329
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
321330
with:
322-
path: client-sdk-rust/target/
323-
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-${{ steps.rust_sha.outputs.sha }}
331+
path: |
332+
client-sdk-rust/target/
333+
${{ env.CARGO_TARGET_DIR }}
334+
key: ${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-${{ steps.rust_sha.outputs.sha }}
324335
restore-keys: |
325-
${{ matrix.os }}-${{ matrix.name }}-cargo-target-
336+
${{ matrix.os }}-${{ matrix.name }}-cargo-target-v2-
326337
327338
# restore-keys can hydrate target/ from a prior submodule SHA. cxxbridge
328339
# artifacts in webrtc-sys are not compatible across those bumps.
329340
- name: Drop stale cargo target on submodule SHA cache miss
330341
if: steps.cache-cargo-target.outputs.cache-hit != 'true'
331342
shell: bash
332-
run: rm -rf client-sdk-rust/target/
343+
run: rm -rf client-sdk-rust/target/ "$CARGO_TARGET_DIR"
333344

334345
# ---------- Build environment setup ----------
335346
- name: Set Linux build environment

‎AGENTS.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ GStreamer development and runtime libraries. Release workflows publish separate
139139
`src/tests/packaging/`.
140140

141141
Rust FFI outputs live under `client-sdk-rust/target/cpp-<feature-hash>/` to isolate
142-
Cargo feature configurations. Generated public build metadata lives under each
142+
Cargo feature configurations. Set `CARGO_TARGET_DIR` to override the root;
143+
feature-specific directories are appended. Windows CI uses a short root under
144+
`runner.temp` to keep nested WebRTC header paths below the Windows path limit.
145+
Generated public build metadata lives under each
143146
build directory's `generated/include/livekit/build.h`; do not generate it into
144147
the source tree. Track capture Rust sources and shaders in build dependencies.
145148

‎CMakeLists.txt‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,14 @@ endif()
239239
# Include the feature selection in the path, including future feature changes.
240240
string(SHA256 LIVEKIT_CARGO_FEATURE_HASH "${LIVEKIT_CARGO_FEATURES}")
241241
string(SUBSTRING "${LIVEKIT_CARGO_FEATURE_HASH}" 0 16 LIVEKIT_CARGO_FEATURE_HASH)
242-
set(LIVEKIT_CARGO_TARGET_DIR "${RUST_ROOT}/target/cpp-${LIVEKIT_CARGO_FEATURE_HASH}")
242+
# A short Cargo root avoids MAX_PATH failures in nested WebRTC headers on Windows.
243+
# Treat CARGO_TARGET_DIR as the root; retain feature-specific subdirectories.
244+
set(LIVEKIT_CARGO_TARGET_ROOT "${RUST_ROOT}/target")
245+
if(DEFINED ENV{CARGO_TARGET_DIR} AND NOT "$ENV{CARGO_TARGET_DIR}" STREQUAL "")
246+
get_filename_component(LIVEKIT_CARGO_TARGET_ROOT "$ENV{CARGO_TARGET_DIR}"
247+
ABSOLUTE BASE_DIR "${RUST_ROOT}")
248+
endif()
249+
set(LIVEKIT_CARGO_TARGET_DIR "${LIVEKIT_CARGO_TARGET_ROOT}/cpp-${LIVEKIT_CARGO_FEATURE_HASH}")
243250
if(RUST_TARGET_TRIPLE)
244251
set(RUST_TARGET_DIR "${LIVEKIT_CARGO_TARGET_DIR}/${RUST_TARGET_TRIPLE}")
245252
else()

‎docs/building.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,17 @@ cmake --build build --target clean_generated # Generated protobuf headers
348348
cmake --build build --target clean_all # Full clean
349349
```
350350

351+
## Cargo output paths on Windows
352+
353+
The SDK places Rust FFI outputs in `client-sdk-rust/target/cpp-<feature-hash>/`.
354+
Deep checkout paths can make WebRTC header paths exceed the Windows path limit.
355+
Set `CARGO_TARGET_DIR` to a short absolute path before building, for example
356+
`set CARGO_TARGET_DIR=C:\lk-rust` in Command Prompt. The SDK appends the
357+
feature directory so capture-enabled and disabled outputs remain separate.
358+
Windows CI uses this setting for builds, tests, and release bundles.
359+
`clean-all` removes the default Rust target directory; remove a custom root
360+
separately when it is no longer needed.
361+
351362
## Capture sources
352363

353364
Standard `debug`, `release`, and `*-examples` builds disable capture. The

0 commit comments

Comments
 (0)