Remove default link-time dependency on GLib#1144
Merged
Merged
Conversation
The webrtc-sys build script used pkg_config::probe_library for glib-2.0/gobject-2.0/gio-2.0, which emitted cargo:rustc-link-lib directives even though only the headers are required at build time. Switch to pkg_config::Config::new().cargo_metadata(false) so the include paths are still discovered but no link metadata is emitted. Drop glib-main-loop from libwebrtc's default features and re-expose it as an opt-in passthrough on the top-level livekit crate. The screensharing example enables it explicitly. ### Breaking changes Consumers of `livekit` or `libwebrtc` that rely on Wayland screen sharing must now enable the `glib-main-loop` feature (if they do not have their own GLib main loop).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before you submit your PR
Make sure the following is true before submitting your PR:
PR Description
The webrtc-sys build script used pkg_config::probe_library for glib-2.0/gobject-2.0/gio-2.0, which emitted cargo:rustc-link-lib directives even though only the headers are required at build time. Switch to pkg_config::Config::new().cargo_metadata(false) so the include paths are still discovered but no link metadata is emitted.
Drop glib-main-loop from libwebrtc's default features and re-expose it as an opt-in passthrough on the top-level livekit crate. The screensharing example enables it explicitly. Note that the original change (ca86d4c) was somewhat broken on arrival, since it did not provide any way for a
livekitconsumer to opt out of the internal GLib main loop.Fixes: #1129
Breaking changes
Consumers of
livekitorlibwebrtcthat rely on Wayland screen sharing must now enable theglib-main-loopfeature (if they do not have their own GLib main loop).MSRV
No change.
Testing
Validated that a trivial crate that depends on
livekitno longer pulls inglibas a dependency.Built a cdylib on Linux aarch64 in a build environment where the linker does not use
--as-needed(or it simply does not work as expected), and validated that the resulting binary does not include library dependencies on GLib. See the build artifacts from foxglove/foxglove-sdk#1292 (lib/libfoxglove.so).