Skip to content

bug: build: four cmocka tests don't compile in the default hybrid configuration #1652

Closed

Description

@rdoupe

Found while building master with the defaults from #1588 (OBS_LIBOBS_BACKEND=HYBRID, OBS_BUILD_C_REFERENCE=OFF) and ENABLE_UNIT_TESTS=ON. No upstream report: this is in obs-rust's own build.

Location

  • cmake/common/groups.cmake, _obs_target_impl_languages(): a target that lists a libobs implementation file directly (a test pinning obs-avc.c.h) gets that file's include directories from the target that owns its unity group (_OBS_IMPL_OWNER:<file>). The owner is recorded by _obs_target_groups() for each target that compiles the group.
  • libobs/cmake/implementation.cmake, obs_libobs_add_c_sources(): the ported groups go only to the C targets (OBS_LIBOBS_C_TARGETS). With OBS_LIBOBS_BACKEND=C that's libobs, with OBS_BUILD_C_REFERENCE=ON it's libobs-c-reference. In the default hybrid the list is empty, nothing compiles the ported groups, and their files have no owner. So the test gets none of libobs's include directories.

Class

Build break. ninja fails in a default configuration with unit tests on. libobs and the app build, the test executables don't.

How it is reached

Configure master with the defaults plus -DENABLE_UNIT_TESTS=ON, then ninja (or ninja cmocka-tests):

Target Pinned file Error
test_avc libobs/obs-avc.c.h caption/caption.h: No such file or directory (obs-internal.h:44)
test_video_io_hidden libobs/media-io/video-io.c.h caption/caption.h: No such file or directory
test_pulse_monitor_backlog libobs/audio-monitoring/pulse/pulseaudio-stream-flags.c.h audio-monitoring/pulse/pulseaudio-stream-flags.h: No such file or directory
test_pulse_monitor_flags (same) (same)

ninja -k 0 fails these 4 and builds the other 1,513 edges, including the frontend.

PR CI doesn't see it: rust/tools/linux-validate/validate.sh, rust/tools/tier2-validate/validate.sh and validate.ps1 configure -DOBS_BUILD_C_REFERENCE=ON, and ci/linux_qt_frontend.sh builds only the Qt-linked tests. The nightly sanitizer run (rust/tools/sanitize/sanitize.sh) does use the default hybrid with unit tests and cmake --build -- -k 0, so its asan pass should stop at these errors. The last nightly ran before #1588 merged. CMakePresets.json doesn't set ENABLE_UNIT_TESTS (default OFF), so a plain preset build is not affected.

Reproduced on master

Linux, Ninja, GCC, master 01561bf.

Build Configuration Result
master 01561bf HYBRID, C_REFERENCE OFF (defaults), unit tests ON ninja -k 0: 4 FAILED, the four targets above
master 01561bf same, ninja test_avc caption/caption.h: No such file or directory

Fix

When there is no C target, obs_libobs_add_c_sources() records libobs-objects as the owner of the ported groups' files. It's the object library both libobs binaries share, and it carries libobs's usage requirements (libcaption, the libobs source dir), which is what the C owners passed on before. Backends, defaults and what each target compiles stay as #1588 set them. 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