Skip to content

Add headless Linux build path#1024

Open
mikefaille wants to merge 5 commits intolivekit:mainfrom
mikefaille:headless-linux-support
Open

Add headless Linux build path#1024
mikefaille wants to merge 5 commits intolivekit:mainfrom
mikefaille:headless-linux-support

Conversation

@mikefaille
Copy link
Copy Markdown

@mikefaille mikefaille commented Apr 19, 2026

Summary

  • make headless Linux an explicit supported path without changing the default desktop build behavior
  • re-expose glib-main-loop through livekit while keeping it enabled by default for desktop-oriented consumers
  • add LK_HEADLESS=1 handling in webrtc-sys/build.rs to skip Linux desktop capturer sources, GLib/GIO probing, and X11 desktop-capture linkage
  • pin direct desktop examples back to glib-main-loop explicitly so example behavior remains desktop-friendly

Why

On Linux, libwebrtc enables glib-main-loop by default and livekit inherited that behavior transitively. That made it impossible to build an intentionally headless Linux configuration without pulling in the GLib desktop path. This change preserves the existing default behavior while making the headless path explicit and supported.

Headless Linux requires both pieces:

  • LK_HEADLESS=1 changes the Linux native build path in webrtc-sys
  • --no-default-features -F tokio disables the default desktop-oriented glib-main-loop feature in the Rust dependency graph

In other words, LK_HEADLESS=1 by itself is not intended to change the default feature selection for livekit.

Validation

  • cargo build -p livekit
  • LK_HEADLESS=1 cargo build -p livekit --no-default-features -F tokio
  • cargo tree -p livekit -i glib shows glib in the default build
  • LK_HEADLESS=1 cargo tree -p livekit --no-default-features -F tokio -i glib shows glib absent from the graph

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 19, 2026

CLA assistant check
All committers have signed the CLA.

@mikefaille mikefaille changed the title [codex] Add headless Linux build path Add headless Linux build path Apr 19, 2026
@mikefaille mikefaille marked this pull request as ready for review April 21, 2026 05:55
@mikefaille
Copy link
Copy Markdown
Author

There is one test failing but I don't part it's from this pr. @typester @ladvoc and @reenboog

@reenboog
Copy link
Copy Markdown
Contributor

Looks good to me. That failing test has been there before, no worries. There's a merge conflict – please resolve it and we're good to go.

@mikefaille
Copy link
Copy Markdown
Author

@reenboog
thank you !

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f720ceb39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread livekit/Cargo.toml
async = ["livekit-api/signal-client-async"]
tokio = ["livekit-api/signal-client-tokio"]
dispatcher = ["livekit-api/signal-client-dispatcher"]
glib-main-loop = ["libwebrtc/glib-main-loop"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Disable libwebrtc defaults for headless feature control

This adds a glib-main-loop feature toggle at the livekit level, but the libwebrtc dependency still uses its own default features, so cargo build -p livekit --no-default-features -F tokio will continue to enable libwebrtc’s default glib-main-loop path. In practice, headless Linux builds still pull GLib transitively unless libwebrtc is declared with default-features = false, which means the new documented headless flow is not actually enforced by this feature wiring.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in the following commit

mikefaille added 2 commits May 8, 2026 06:47
…main-loop

This change disables default features for the libwebrtc workspace dependency.

Previously, when building livekit with '--no-default-features -F tokio', the
libwebrtc workspace entry would still propagate its own default features
(specifically glib-main-loop) to all workspace members. This caused headless
Linux builds to unexpectedly pull in GLib and its system dependencies.

Setting 'default-features = false' at the workspace level ensures that feature
selection remains explicit and under the control of the target crate or example,
while still allowing crates like 'local_audio' to enable it as needed.

Verified with:
- cargo tree -p livekit --no-default-features -F tokio -i glib (confirmed gone)
- cargo build -p livekit --no-default-features -F tokio (confirmed working)
…4-findings

Disable libwebrtc default features in workspace dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants