From 9ba65944df02890b36de6fe38888e3b5154f2c8d Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Tue, 3 Mar 2026 10:25:01 +0100 Subject: [PATCH] livekit: Correctly handle runtime deps: libva and libva-drm (#50527) Release Notes: - N/A --- Cargo.lock | 15 ++++++++------- Cargo.toml | 4 ++-- crates/zed/Cargo.toml | 3 +++ crates/zed/build.rs | 19 +++++++++++++++++++ nix/build.nix | 1 + script/linux | 4 ++++ 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9f56a58f68f39671c03d591cc8535cbdc4cde6d6..c4dcfa054efa372259880c3a813a5d203e9c1be7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9699,7 +9699,7 @@ dependencies = [ [[package]] name = "libwebrtc" version = "0.3.26" -source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fccf29d1d0d0a139b2e50746b0b9a1bac828fa04#fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" +source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=37835f840d0070d45ac8b31cce6a6ae7aca3f459#37835f840d0070d45ac8b31cce6a6ae7aca3f459" dependencies = [ "cxx", "glib", @@ -9797,7 +9797,7 @@ checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" [[package]] name = "livekit" version = "0.7.32" -source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fccf29d1d0d0a139b2e50746b0b9a1bac828fa04#fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" +source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=37835f840d0070d45ac8b31cce6a6ae7aca3f459#37835f840d0070d45ac8b31cce6a6ae7aca3f459" dependencies = [ "base64 0.22.1", "bmrng", @@ -9823,7 +9823,7 @@ dependencies = [ [[package]] name = "livekit-api" version = "0.4.14" -source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fccf29d1d0d0a139b2e50746b0b9a1bac828fa04#fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" +source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=37835f840d0070d45ac8b31cce6a6ae7aca3f459#37835f840d0070d45ac8b31cce6a6ae7aca3f459" dependencies = [ "base64 0.21.7", "futures-util", @@ -9850,7 +9850,7 @@ dependencies = [ [[package]] name = "livekit-protocol" version = "0.7.1" -source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fccf29d1d0d0a139b2e50746b0b9a1bac828fa04#fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" +source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=37835f840d0070d45ac8b31cce6a6ae7aca3f459#37835f840d0070d45ac8b31cce6a6ae7aca3f459" dependencies = [ "futures-util", "livekit-runtime", @@ -9866,7 +9866,7 @@ dependencies = [ [[package]] name = "livekit-runtime" version = "0.4.0" -source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fccf29d1d0d0a139b2e50746b0b9a1bac828fa04#fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" +source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=37835f840d0070d45ac8b31cce6a6ae7aca3f459#37835f840d0070d45ac8b31cce6a6ae7aca3f459" dependencies = [ "tokio", "tokio-stream", @@ -19841,7 +19841,7 @@ dependencies = [ [[package]] name = "webrtc-sys" version = "0.3.23" -source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fccf29d1d0d0a139b2e50746b0b9a1bac828fa04#fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" +source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=37835f840d0070d45ac8b31cce6a6ae7aca3f459#37835f840d0070d45ac8b31cce6a6ae7aca3f459" dependencies = [ "cc", "cxx", @@ -19855,7 +19855,7 @@ dependencies = [ [[package]] name = "webrtc-sys-build" version = "0.3.13" -source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=fccf29d1d0d0a139b2e50746b0b9a1bac828fa04#fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" +source = "git+https://github.com/zed-industries/livekit-rust-sdks?rev=37835f840d0070d45ac8b31cce6a6ae7aca3f459#37835f840d0070d45ac8b31cce6a6ae7aca3f459" dependencies = [ "anyhow", "fs2", @@ -21791,6 +21791,7 @@ dependencies = [ "parking_lot", "paths", "picker", + "pkg-config", "pretty_assertions", "profiling", "project", diff --git a/Cargo.toml b/Cargo.toml index c50b329772669105a7ae3a5f19562fbd186d23ea..98fccfaeb21bc6107323378605c8299d5bd5838f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -835,8 +835,8 @@ notify = { git = "https://github.com/zed-industries/notify.git", rev = "ce58c24c notify-types = { git = "https://github.com/zed-industries/notify.git", rev = "ce58c24cad542c28e04ced02e20325a4ec28a31d" } windows-capture = { git = "https://github.com/zed-industries/windows-capture.git", rev = "f0d6c1b6691db75461b732f6d5ff56eed002eeb9" } calloop = { git = "https://github.com/zed-industries/calloop" } -livekit = { git = "https://github.com/zed-industries/livekit-rust-sdks", rev = "fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" } -libwebrtc = { git = "https://github.com/zed-industries/livekit-rust-sdks", rev = "fccf29d1d0d0a139b2e50746b0b9a1bac828fa04" } +livekit = { git = "https://github.com/zed-industries/livekit-rust-sdks", rev = "37835f840d0070d45ac8b31cce6a6ae7aca3f459" } +libwebrtc = { git = "https://github.com/zed-industries/livekit-rust-sdks", rev = "37835f840d0070d45ac8b31cce6a6ae7aca3f459" } [profile.dev] split-debuginfo = "unpacked" diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 16385ccf75e245b4e4bf17cf37a1d04ef3ed9c6b..cf8df08c010bfe643b93b5628cf520ee2ec1dd8b 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -241,6 +241,9 @@ gpui = { workspace = true, features = [ ] } ashpd.workspace = true +[target.'cfg(target_os = "linux")'.build-dependencies] +pkg-config = "0.3.22" + [dev-dependencies] call = { workspace = true, features = ["test-support"] } dap = { workspace = true, features = ["test-support"] } diff --git a/crates/zed/build.rs b/crates/zed/build.rs index 7e22752d35d9115efd735bfc7b2690f4bf5680d3..e169760acf16d6caa44aeb2004cd823a355f36ee 100644 --- a/crates/zed/build.rs +++ b/crates/zed/build.rs @@ -2,6 +2,25 @@ use std::process::Command; fn main() { + #[cfg(target_os = "linux")] + { + // Add rpaths for libraries that webrtc-sys dlopens at runtime. + // This is mostly required for hosts with non-standard SO installation + // locations such as NixOS. + let dlopened_libs = ["libva", "libva-drm"]; + + let mut rpath_dirs = std::collections::BTreeSet::new(); + for lib in &dlopened_libs { + if let Some(libdir) = pkg_config::get_variable(lib, "libdir").ok() { + rpath_dirs.insert(libdir); + } + } + + for dir in &rpath_dirs { + println!("cargo:rustc-link-arg=-Wl,-rpath,{dir}"); + } + } + if cfg!(target_os = "macos") { println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.15.7"); diff --git a/nix/build.nix b/nix/build.nix index 3ae9ca95506baf05b8a433d1232190773b41321e..68f8a4acdbe83f7e8981659dd0376ec87ef52dfe 100644 --- a/nix/build.nix +++ b/nix/build.nix @@ -233,6 +233,7 @@ let lib.makeLibraryPath [ gpu-lib wayland + libva ] }"; diff --git a/script/linux b/script/linux index b3bd03eacc2baf976744ff19b049b7781c330a8e..706fa63b037e290cd7991d3adfa42fac0c0cfe25 100755 --- a/script/linux +++ b/script/linux @@ -155,6 +155,7 @@ if [[ -n $zyp ]]; then cmake fontconfig-devel gcc + libva-devel gcc-c++ glib2-devel git @@ -191,6 +192,7 @@ if [[ -n $pacman ]]; then alsa-lib fontconfig glib2 + libva wayland libgit2 libxcb @@ -222,6 +224,7 @@ if [[ -n $xbps ]]; then alsa-lib-devel fontconfig-devel glib-devel + libva-devel libxcb-devel libxkbcommon-devel libzstd-devel @@ -249,6 +252,7 @@ if [[ -n $emerge ]]; then dev-util/cmake media-libs/alsa-lib media-libs/fontconfig + media-libs/libva media-libs/vulkan-loader x11-libs/libxcb x11-libs/libxkbcommon