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
6 changes: 5 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# We need lld to link libwebrtc.a successfully on aarch64-linux
[target.aarch64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

Expand All @@ -14,4 +18,4 @@ rustflags = ["-C", "link-args=-ObjC"]
rustflags = ["-C", "link-args=-ObjC"]

[target.aarch64-apple-ios-sim]
rustflags = ["-C", "link-args=-ObjC"]
rustflags = ["-C", "link-args=-ObjC"]
17 changes: 17 additions & 0 deletions .changeset/fix_clang_build_issue_from_zed_patches_949.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
webrtc-sys: patch
webrtc-sys-build: patch
libwebrtc: patch
---

# fix clang build issue from zed patches (#949)

#950 by @cloudwebrtc

* webrtc-sys: Use clang instead of gcc

* Debug CI output for aarch64-linux

* ci: Install lld for aarch64-linux FFI builders

* webrtc-sys: Disable CREL
2 changes: 2 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ jobs:
sudo apt update -y
# libasound2-dev is needed for local_audio example
# libdrm, libgbm, libxfixes, libxdamage, libxrandr, libxcomposite and libglib are needed for DesktopCapturer
# lld is needed on aarch64 because GNU ld cannot link libwebrtc.a for some reason
sudo apt install -y \
lld \
libasound2-dev \
libssl-dev \
libx11-dev \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ffi-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
docker run --rm -v $PWD:/workspace -w /workspace ${{ matrix.build_image }} bash -c "\
uname -a; \
export PATH=/root/.cargo/bin:\$PATH; \
yum install llvm llvm-libs -y; \
yum install llvm llvm-libs lld -y; \
yum install clang -y; \
yum install protobuf-compiler -y; \
yum groupinstall 'Development Tools' -y; \
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/webrtc-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,6 @@ jobs:
run: |
pip3 install setuptools # pkg_resources is sometimes not found?

- name: Add GCC PPA and install GCC 14
if: ${{ matrix.target.os == 'ubuntu-latest' }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt install gcc-14 g++-14 g++-14-aarch64-linux-gnu -y

- name: Verify GCC 14 installation
if: ${{ matrix.target.os == 'ubuntu-latest' }}
run: |
gcc-14 --version
g++-14 --version
aarch64-linux-gnu-g++-14 --version

- name: Set GCC 14 as default (optional)
if: ${{ matrix.target.os == 'ubuntu-latest' }}
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140 --slave /usr/bin/g++ g++ /usr/bin/g++-14
sudo update-alternatives --config gcc
gcc --version
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-14 140 --slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-14
sudo update-alternatives --config aarch64-linux-gnu-gcc
aarch64-linux-gnu-gcc --version

- name: Install linux dependencies
if: ${{ matrix.target.os == 'ubuntu-latest' }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion webrtc-sys/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use regex::Regex;
use reqwest::StatusCode;

pub const SCRATH_PATH: &str = "livekit_webrtc";
pub const WEBRTC_TAG: &str = "webrtc-0001d84-2";
pub const WEBRTC_TAG: &str = "webrtc-24f6822";
pub const IGNORE_DEFINES: [&str; 2] = ["CR_CLANG_REVISION", "CR_XCODE_VERSION"];

pub fn target_os() -> String {
Expand Down
18 changes: 7 additions & 11 deletions webrtc-sys/libwebrtc/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ git apply "$COMMAND_DIR/patches/add_licenses.patch" -v --ignore-space-change --i
git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn

cd build

git apply "$COMMAND_DIR/patches/force_gcc.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn

cd ..
# Disable CREL (compact relocations). Chromium's build enables experimental
# CREL via -Wa,--crel which causes segfaults on aarch64-linux (and is known
# broken on arm32 and s390x too).
# See: https://crbug.com/376278218
# See: https://github.com/zed-industries/zed/pull/51433#discussion_r2944567608
git -C build apply "$COMMAND_DIR/patches/disable_crel.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn

cd third_party

Expand All @@ -87,10 +88,6 @@ mkdir -p "$ARTIFACTS_DIR/lib"

python3 "./src/build/linux/sysroot_scripts/install-sysroot.py" --arch="$arch"

if [ "$arch" = "arm64" ]; then
sudo sed -i 's/__GLIBC_USE_ISOC2X[[:space:]]*1/__GLIBC_USE_ISOC2X\t0/' /usr/aarch64-linux-gnu/include/features.h
fi

debug="false"
if [ "$profile" = "debug" ]; then
debug="true"
Expand Down Expand Up @@ -119,7 +116,6 @@ args="is_debug=$debug \
symbol_level=0 \
enable_iterator_debugging=false \
use_rtti=true \
is_clang=false \
rtc_use_x11=true"

# generate ninja files
Expand All @@ -131,7 +127,7 @@ ninja -C "$OUTPUT_DIR" :default
# make libwebrtc.a
# don't include nasm
ar -rc "$ARTIFACTS_DIR/lib/libwebrtc.a" `find "$OUTPUT_DIR/obj" -name '*.o' -not -path "*/third_party/nasm/*"`
objcopy --redefine-syms="$COMMAND_DIR/boringssl_prefix_symbols.txt" "$ARTIFACTS_DIR/lib/libwebrtc.a"
src/third_party/llvm-build/Release+Asserts/bin/llvm-objcopy --redefine-syms="$COMMAND_DIR/boringssl_prefix_symbols.txt" "$ARTIFACTS_DIR/lib/libwebrtc.a"

python3 "./src/tools_webrtc/libs/generate_licenses.py" \
--target :default "$OUTPUT_DIR" "$OUTPUT_DIR"
Expand Down
17 changes: 17 additions & 0 deletions webrtc-sys/libwebrtc/patches/disable_crel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
--- a/config/compiler/BUILD.gn
+++ b/config/compiler/BUILD.gn
@@ -617,13 +617,6 @@ config("compiler") {
cflags += [ "-ffp-contract=off" ]
}

- # Enable ELF CREL (see crbug.com/357878242) for all platforms that use ELF
- # (excluding toolchains that use an older version of LLVM).
- if (is_linux && use_lld && !llvm_android_mainline &&
- default_toolchain != "//build/toolchain/cros:target") {
- cflags += [ "-Wa,--crel,--allow-experimental-crel" ]
- }
-
# TODO(crbug.com/413427035): Remove once
# https://github.com/llvm/llvm-project/pull/136867/ is landed.
if (!is_win && !llvm_android_mainline &&
24 changes: 0 additions & 24 deletions webrtc-sys/libwebrtc/patches/force_gcc.patch

This file was deleted.

Loading