Skip to content

Commit 024a137

Browse files
committed
fix linux compile issue.
1 parent bf52ad6 commit 024a137

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

webrtc-sys/libwebrtc/build_linux.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ git apply "$COMMAND_DIR/patches/fix_payload_type_picker_compile.patch" -v --igno
8181
git apply "$COMMAND_DIR/patches/fix_pipewire_utils_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
8282
git apply "$COMMAND_DIR/patches/fix_ssl_stream_adapter_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
8383
git apply "$COMMAND_DIR/patches/fix_copy_on_write_buffer_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
84+
git apply "$COMMAND_DIR/patches/fix_rtp_config_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
8485

8586
# Disable CREL (compact relocations). Chromium's build enables experimental
8687
# CREL via -Wa,--crel which causes segfaults on aarch64-linux (and is known
@@ -111,12 +112,23 @@ fi
111112
# Note: use_clang_modules=false is required to avoid C++ module compilation issues.
112113
# Without this flag, the build may fail partway through, resulting in missing
113114
# or incomplete artifacts.
115+
#
116+
# Note: use_sysroot=false is required because use_custom_libcxx=false makes the
117+
# public API's ABI depend on whichever libstdc++ built it. m150 uses std::span
118+
# by value across that API (it replaced rtc::ArrayView), and libstdc++ reordered
119+
# std::span's members: the bundled debian_bullseye sysroot (GCC 10) lays it out
120+
# as {extent, ptr} while GCC >= 14 uses {ptr, extent}. Since std::span is 16
121+
# bytes and trivially copyable it is passed in two registers, so building
122+
# against the sysroot while webrtc-sys compiles with the system compiler swaps
123+
# pointer and size on every such call. Building against the system libstdc++
124+
# keeps both sides consistent.
114125
args="is_debug=$debug \
115126
target_os=\"linux\" \
116127
target_cpu=\"$arch\" \
117128
rtc_enable_protobuf=false \
118129
treat_warnings_as_errors=false \
119130
use_llvm_libatomic=false \
131+
use_sysroot=false \
120132
use_custom_libcxx=false \
121133
use_custom_libcxx_for_host=false \
122134
use_clang_modules=false \
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/call/rtp_config.cc b/call/rtp_config.cc
2+
index 560ec099d6..c8fe7f1533 100644
3+
--- a/call/rtp_config.cc
4+
+++ b/call/rtp_config.cc
5+
@@ -251,7 +251,12 @@ RtpStreamConfig RtpConfig::GetStreamConfig(size_t index) const {
6+
stream_config.raw_payload = raw_payload;
7+
if (!rtx.ssrcs.empty()) {
8+
RTC_DCHECK_EQ(ssrcs.size(), rtx.ssrcs.size());
9+
- auto& stream_config_rtx = stream_config.rtx.emplace();
10+
+ // Pass an explicit value rather than using the no-argument emplace().
11+
+ // libstdc++ 15 constrains emplace() on is_constructible_v<Rtx>, and clang
12+
+ // fails that check for a class nested inside the still-incomplete
13+
+ // RtpStreamConfig. g++ accepts it; clang does not.
14+
+ auto& stream_config_rtx =
15+
+ stream_config.rtx.emplace(RtpStreamConfig::Rtx{});
16+
stream_config_rtx.ssrc = rtx.ssrcs[index];
17+
stream_config_rtx.payload_type = rtx.payload_type;
18+
}

0 commit comments

Comments
 (0)