Skip to content

bug: test: the C-backend test build fails to link test_effect_parser_lifecycle_rust #1683

Closed

Description

@rdoupe

Our own regression, from #1650 (port of the effect parser lifecycle to obs-graphics, merged 2026-10-21). A build with -DOBS_LIBOBS_BACKEND=C and unit tests no longer builds all its test targets:

FAILED: [code=1] test/cmocka/test_effect_parser_lifecycle_rust
/usr/bin/ld: cannot find -llibobs_rust-static: No such file or directory
collect2: error: ld returned 1 exit status

Location

test/cmocka/tests.d/test_effect_parser_lifecycle.cmake: #1650 added a second test, test_effect_parser_lifecycle_rust, which runs the same C assertions against the production Rust staticlib and links libobs_rust-static unconditionally. That target exists only with the hybrid backend. With OBS_LIBOBS_BACKEND=C no target of that name exists, so CMake passes it to the linker as a plain library name, -llibobs_rust-static, and the link fails. test_preflight_abi.cmake already guards its use of the same target with if(TARGET libobs_rust-static).

The C variant in the same file, test_effect_parser_lifecycle (from #1646), compiles the extracted C source itself and builds in both backends.

Class

Build break, C backend with unit tests only. The default hybrid build and every release build are unaffected.

How it is reached

Configure with -DOBS_LIBOBS_BACKEND=C -DENABLE_UNIT_TESTS=ON and build. Plain ninja stops at that target; ninja -k 0 builds everything else and reports 1 FAILED.

CI doesn't catch it because CI never builds the C backend with unit tests:

  • Every Ubuntu, macOS and Windows build job uses the default backend (HYBRID). Their ENABLE_RUST_LIBOBS matrix (ON/OFF) now only picks the product identity (OBS_BRAND_RUST), not the backend.
  • sanitizers.yaml selects the C backend (through rust/tools/sanitize/sanitize.sh, with unit tests) only when it is dispatched by hand with rust_libobs: false. The nightly schedule runs it with the hybrid backend.
  • ci/test_hybrid_default.py configures -DOBS_LIBOBS_BACKEND=C, but on a small stand-in project, not the repository's tests.

Reproduced

Headless (private Xvfb, private D-Bus, fresh HOME), RelWithDebInfo, ccache.

Build Case Result
master f1783cf, OBS_LIBOBS_BACKEND=C ninja -k 0 1 FAILED: test_effect_parser_lifecycle_rust, cannot find -llibobs_rust-static
master f1783cf, OBS_LIBOBS_BACKEND=HYBRID ninja -k 0 0 FAILED; test_effect_parser_lifecycle and _rust pass

Fix

Build and register test_effect_parser_lifecycle_rust only if(TARGET libobs_rust-static), as test_preflight_abi does. That matches what #1650 means by it: it tests "the exact production Rust staticlib", which only the hybrid backend has. The C variant keeps running in both backends. Since CI builds no C backend with tests, a static check in ci/ (run by the lint lane and PR CI) also makes sure every tests.d/*.cmake names libobs_rust-static only inside such a guard. PR follows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions