Skip to content

build(libobs): cache lib-module archives by what they compile (#3262) - #3321

Merged
zackees merged 2 commits into
masterfrom
build/3262-module-cache
Nov 1, 2026
Merged

zackees merged 2 commits into
masterfrom
build/3262-module-cache

Conversation

@zackees

@zackees zackees commented Nov 1, 2026

Copy link
Copy Markdown
Member

Refs #3262. Stacked on #3318 (modules as static archives); this retargets to master once #3318 merges.

ci/libobs_modules.py keys each libobs lib-module and caches its archive:

  • Key: a blake2b digest over the module's compile commands (build and source dirs as placeholders, the compiler launcher left out), the content of every file its groups read (preprocessor -M -MG, no compile), and the compiler's --version. It is blake2b, not BLAKE3, because ci scripts stay stdlib-only.
  • restore: copies each hit to <build>/libobs-modcache/ and writes hits.cmake.
  • store: copies the archive of each module that was built.
  • libobs/cmake/modules.cmake: with -DOBS_LIBOBS_MODULE_CACHE, a hit becomes an IMPORTED archive, still linked whole. An unbuilt -keyprobe OBJECT target keeps the hit's compile commands in compile_commands.json, so a later edit changes the key and the next restore drops the hit. A changed hits.cmake re-runs configure.

RED: 01b353e98 adds ci/test_libobs_modules_cache.py. It fails without the tool (FileNotFoundError: ci/libobs_modules.py).
GREEN: 5aca13b05. The 4 cache tests and the 3 module tests pass, and ./lint passes.

End to end (Linux, linux-validate container, zccache warm):

case wall module compiles
A: cold build, then store 21 s 10
B: fresh build dir, warm cache (configure, restore, reconfigure, build) 23 s 0 (5 of 5 restored)
B, after editing libobs/graphics/effect.c.h 10 s 1 (only libobs-mod-graphics)

libobs.so exports are identical between A and B (1,767).

What's left on #3262 (why this is Refs, not Fixes):

Tiers 1-4 don't apply: this is build tooling with no Rust or C behavior change.

@zackees
zackees force-pushed the build/3262-module-cache branch from 5aca13b to c7bba8d Compare November 1, 2026 02:14
@zackees
zackees marked this pull request as ready for review November 1, 2026 02:21
@zackees
zackees enabled auto-merge November 1, 2026 02:21
@zackees
zackees added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 1, 2026
@zackees
zackees added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 1, 2026
@zackees
zackees added this pull request to the merge queue Nov 1, 2026
Merged via the queue into master with commit 15bc080 Nov 1, 2026
40 checks passed
@zackees
zackees deleted the build/3262-module-cache branch November 1, 2026 04:02
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Nov 1, 2026
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.

1 participant