Skip to content

build(libobs): lib-modules are static archives linked whole into libobs (#3261) - #3318

Merged
zackees merged 2 commits into
masterfrom
build/3261-static-modules
Nov 1, 2026
Merged

zackees merged 2 commits into
masterfrom
build/3261-static-modules

Conversation

@zackees

@zackees zackees commented Nov 1, 2026

Copy link
Copy Markdown
Member

What

libobs/cmake/modules.cmake:

  • Static archives. Each libobs-mod-<module> is now a STATIC archive, not an OBJECT library: the unit the module cache (build(libobs): content-addressed module artifact cache #3262) will key, store and restore.
  • Linked whole. The shared libraries link each archive through $<LINK_LIBRARY:WHOLE_ARCHIVE,...> (--whole-archive, -force_load, /WHOLEARCHIVE). A plain archive link would drop objects that nothing references by name: registrations and callback-only code.
  • No objects absorbed. A static library that links an OBJECT library takes its objects in, and the shared libraries already link libobs-core-modules and libobs-version themselves. So a module now takes only an OBJECT library's compile requirements, the same handling build(libobs): split libobs-objects into per-module OBJECT libraries #3259 gave the interface-sourced OBS::obfuscate.

Verification (Linux, obs-rust-linux-validate image, RelWithDebInfo hybrid, master vs branch)

  • Compile commands: identical for all libobs groups (0 differing).
  • Exports: nm -D --defined-only libobs.so is identical, 1,767 symbols.
  • All defined symbols, hidden included: nm --defined-only libobs.so is identical, 8,273 symbols. So the archive link dropped no object.
  • Build time: configure plus a cold libobs build took 25 s on this branch against 30 s on master (one sample each, loaded host).

Windows and macOS: PR CI's Tier 2 lanes link libobs through this path.

RED → GREEN

  • RED: ci/test_libobs_modules.py ArchiveTest fails on master, where modules are OBJECT libraries with no whole-archive link and no object-library guard.
  • GREEN: the test passes, as do test_build_groups.py, test_shared_build_files.py and ./lint.

Test cost: one more Python test, under 1 ms.

Fixes #3261. Refs #3256.

@zackees
zackees enabled auto-merge November 1, 2026 01:26
@zackees
zackees added this pull request to the merge queue Nov 1, 2026
Merged via the queue into master with commit ce8ec7a Nov 1, 2026
41 checks passed
@zackees
zackees deleted the build/3261-static-modules branch November 1, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

build(libobs): static module archives relinked whole-archive into libobs

1 participant