Skip to content

build(libobs): tracker — decentralized lib-modules in a content-addressed artifact cache, relinked into libobs #3256

Open
8 of 9 issues completed

Description

@zackees

Goal (maintainer, 2026-10-31)

Refactor the libobs build into decentralized lib-modules. Each module is stored in an artifact cache keyed by its content, so code is not recompiled when nothing in that module changed. All modules are then relinked into libobs, and the public C ABI and export set stay unchanged.

Current state

  • C build: one libobs-objects OBJECT library (libobs/cmake/implementation.cmake:10-11) holds the 194 LIBOBS_SOURCES, fed by 166 unity groups in libobs/build/ (source-sets.json, ported-source-sets/*.json). Ported C (108 sources) is compiled only for libobs-c-reference.
  • Rust: a Corrosion release staticlib, linked whole-archive (libobs/cmake/rust.cmake:20-35), with the export map, Windows list and macOS unexport list in rust-os-*.cmake.
  • zccache already content-caches every translation unit. So the costs that remain are:
    1. A shared precompiled header. Every core group shares libobs/build/libobs.pch.h (BUILD.md rule 2), so one header edit rebuilds nearly all of libobs.
    2. The oracle compiles libobs a third time. rust/obs-c-oracle/build.rs:3-12 hashes all of libobs/ and re-runs cc over libobs C on any edit, sharing nothing with CMake.
    3. Configure, Corrosion and link run every time. Warm and edited-input rebuilds take about 6 s wall for 0.6 s of CPU (docs/rust-port/benchmarks/hybrid-build-2026-10-20.json).
  • CI saves zccache only on master (docs/ci-tooling.md:243-250).

Target

  • Modules: libobs-mod-<name> static libraries along the existing group families: util, core, graphics, media, platform-, ported, rust-shims. They share one libobs-headers INTERFACE for flags and each has its own narrowed precompiled header.
  • Keys: each module's key hashes its sources, its depfile include closure, normalised flags and the toolchain identity. Modules are restored from a module cache (local dir plus the existing .github/actions/cache) as IMPORTED libraries, skipping compilation entirely. This reuses zccache/soldr; there is no new tool.
  • Relink: libobs links every module whole-archive plus the Rust staticlib, with the unchanged export map. A symbol diff runs on all three operating systems.
  • Oracle: it links the cached ported and util modules, and falls back to cc for plain cargo test.

Rules

  • The public C ABI and export set are unchanged, verified by a symbol diff.
  • BUILD.md unity and precompiled-header rules hold, and each group belongs to exactly one module.
  • No new workflow files.
  • Every sub-issue records before and after build times against the baseline from the first sub-issue.

Risks

  • Static archives dropping registration objects: whole-archive is mandatory, backed by a module-load smoke test.
  • Duplicate symbols: a group in two modules; the checker in the manifest sub-issue guards this.
  • Visibility and IS_LIBOBS: these stay on libobs-headers only.
  • LTO/IPO (perf: build: enable IPO for the shipped RelWithDebInfo C build #3193): cached IR is tied to the compiler version, so the LTO mode goes into the key.
  • Linkers: MSVC /WHOLEARCHIVE link cost, ld64 -force_load with the unexport list, and GNU ld archive order.
  • Generated headers: obsconfig.h and the version object must be part of the key.

Sub-issues

Sub-issues

8 of 9 Issues completed
Loading 9 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    tracker

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions