Bug 311527
| Summary: | [GTK][WebRTC] WebKit main fails to link with undefined symbol gst_webrtc_error_quark() in librice ICE sources | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jaron <jaron> |
| Component: | WebRTC | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | jaron, philn, webkit-unassigned, youennf |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| URL: | https://github.com/WebKit/WebKit/tree/c51e9ffac777f72df41726bdc86e3e0be9f67844 | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=311525 | ||
Jaron
After working around the RiceTurnConfig / librice API mismatch from bug 311525, I reproduced a different build failure when compiling WebKit GTK main with GStreamer WebRTC and librice on Linux ARM64.
Environment
- Host: Linux ARM64
- Reproduced on: Ubuntu 24.04 ARM64
- WebKit ref: main at c51e9ffac777f72df41726bdc86e3e0be9f67844
- GStreamer WebRTC: 1.24.2
- librice: main / v0.4.2
Build configuration
- GTK port
- ENABLE_MEDIA_STREAM=ON
- ENABLE_WEB_RTC=ON
- USE_GSTREAMER_WEBRTC=ON
- USE_LIBRICE=ON
- ENABLE_MINIBROWSER=ON
Observed result
The build gets to the final link of libwebkitgtk-6.0.so.4.17.0 and fails with an undefined symbol for gst_webrtc_error_quark().
Exact error excerpt
ld.lld: error: undefined symbol: gst_webrtc_error_quark()
>>> referenced by UnifiedSource-f8afad56-36.cpp
>>> did you mean: extern "C" gst_webrtc_error_quark
>>> defined in: /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so
clang++: error: linker command failed with exit code 1
ninja: build stopped: subcommand failed.
Why this looks like a WebKit source integration issue
Three librice ICE source files include gst/webrtc/webrtc.h directly:
- Source/WebCore/Modules/mediastream/gstreamer/GStreamerIceAgent.cpp
- Source/WebCore/Modules/mediastream/gstreamer/GStreamerIceStream.cpp
- Source/WebCore/Modules/mediastream/gstreamer/GStreamerIceTransport.cpp
Nearby WebRTC files already wrap the same header with GST_USE_UNSTABLE_API, for example:
- Source/WebCore/Modules/mediastream/gstreamer/GStreamerIceTransport.h
- Source/WebCore/Modules/mediastream/gstreamer/GStreamerWebRTCUtils.h
Because the linker reports that the symbol exists in libgstwebrtc-1.0.so and specifically suggests an extern "C" mismatch, this looks like a header / linkage integration issue rather than a missing library.
Possible fix
Wrap the direct gst/webrtc/webrtc.h includes in the three .cpp files above with:
- #define GST_USE_UNSTABLE_API
- #include <gst/webrtc/webrtc.h>
- #undef GST_USE_UNSTABLE_API
That would match the include pattern already used by nearby WebRTC files.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Philippe Normand
What is your linker out of curiosity?
Anyway the proposed fix sounds right indeed. Would you like to send a PR? In case you're up for it but not yet familiar with the workflow, it is documented at https://docs.webkit.org/Getting%20Started/ContributingCode.html
Philippe Normand
(In reply to Philippe Normand from comment #1)
> What is your linker out of curiosity?
>
Oh sorry, it's mentioned in the bug report, ld.lld
Jaron
Pull request: https://github.com/WebKit/WebKit/pull/62090
Jaron
I re-tested this on the supported librice v0.2.1 path, and the same final link failure still reproduces with ld.lld on Ubuntu 24.04 ARM64.
The original GST_USE_UNSTABLE_API hypothesis in the bug report was not the right fix.
The minimal fix that gets past this linker failure is a one-file change in Source/WebCore/Modules/mediastream/gstreamer/GStreamerIceAgent.cpp:
- add a small file-local helper returning the WebRTC error-domain quark via g_quark_from_static_string("gst-webrtc-error-quark")
- replace the four g_error_new(GST_WEBRTC_ERROR, ...) call sites in that file with g_error_new(webkitGstWebRTCErrorQuark(), ...)
With that change applied:
- libwebkitgtk-6.0.so.4.17.0 links successfully
- MiniBrowser links successfully
The build then proceeds to a later packaging/install failure that appears unrelated to this linker issue.
I sent a PR with the one-file GStreamerIceAgent.cpp fix.
Philippe Normand
Can you share the output of nm -s /usr/lib64/libgstwebrtc-1.0.so | grep quark (or wherever is your libgstwebrtc-1.0.so) ?
Jaron
(In reply to Philippe Normand from comment #5)
> Can you share the output of nm -s /usr/lib64/libgstwebrtc-1.0.so | grep
> quark (or wherever is your libgstwebrtc-1.0.so) ?
On the Ubuntu 24.04 ARM64 repro machine, the library is under `/usr/lib/aarch64-linux-gnu/`, not `/usr/lib64/`.
The exact symlinks/files there are:
$ ls -l /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so*
lrwxrwxrwx 1 root root 21 Apr 15 2024 /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so -> libgstwebrtc-1.0.so.0
lrwxrwxrwx 1 root root 28 Apr 15 2024 /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so.0 -> libgstwebrtc-1.0.so.0.2402.0
-rw-r--r-- 1 root root 133144 Apr 15 2024 /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so.0.2402.0
The literal `nm -s /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so | grep quark` produced no output on this package, but the dynamic symbol table does show the symbol:
$ nm -D -C /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so.0 | grep -E 'quark|gst_webrtc_error'
U g_quark_from_static_string
0000000000007c00 T gst_webrtc_error_get_type
000000000000aa60 T gst_webrtc_error_quark
$ readelf -Ws /usr/lib/aarch64-linux-gnu/libgstwebrtc-1.0.so.0 | grep -E 'quark|gst_webrtc_error'
56: 0000000000000000 0 FUNC GLOBAL DEFAULT UND g_quark_from_static_string
127: 000000000000aa60 32 FUNC GLOBAL DEFAULT 11 gst_webrtc_error_quark
154: 0000000000007c00 136 FUNC GLOBAL DEFAULT 11 gst_webrtc_error_get_type
Philippe Normand
I was able to reproduce the issue in a ubuntu-24.04 container, I'll try to dig this further when time allows...
Philippe Normand
I've done some tests on an arm64 machine using ubuntu containers, building with GCC and the default linker. Indeed on 24.04 the build fails as described in this report. On 25.10 and 26.04 the build succeeded.
On 24.04 I also tried a build with mold as linker (export LDFLAGS=-fuse-ld=mold before calling cmake) and the build also failed.
So I'm not entirely sure, but this looks like a toolchain bug in ubuntu 24.04 that was addressed in more recent versions.
Philippe Normand
Or maybe addressed via gstreamer updates...
In any case, upstreaming a workaround in WebKit doesn't seem appropriate, we have no issue with similar gst error macros. So I'll close this bug, sorry :)
Jaron
Adding one more data point from April 11, 2026.
I re-ran this on a fresh `origin/main` checkout on Ubuntu 24.04 ARM64, with only one local WebKit source change on top of upstream:
* Source/WebCore/platform/graphics/gstreamer/GUniquePtrGStreamer.h
The only change was to wrap the `gst/webrtc/webrtc.h` include in `extern "C"` for C++ builds, i.e. from:
#define GST_USE_UNSTABLE_API
#include <gst/webrtc/webrtc.h>
#undef GST_USE_UNSTABLE_API
to:
extern "C" {
#define GST_USE_UNSTABLE_API
#include <gst/webrtc/webrtc.h>
#undef GST_USE_UNSTABLE_API
}
This seems consistent with the original linker diagnostic, which specifically suggested an `extern "C"` mismatch for `gst_webrtc_error_quark()`.
With no other WebKit source changes applied, the GTK/WebRTC build completed successfully and `MiniBrowser` linked successfully. In this setup, the undefined `gst_webrtc_error_quark()` link failure from this bug no longer reproduced.
I realize the bug is already resolved as INVALID, so I am only adding this as another reproducibility data point. I am not claiming this proves the root cause is definitely WebKit-side rather than a Ubuntu 24.04 toolchain/package issue, only that this header-linkage change is sufficient to avoid the failure in my environment.