Skip to content

build: resolve explicit Qt SDK interfaces for Cargo native builds - #1877

Merged
zackees merged 4 commits into
masterfrom
infra/1869-qt-sdk-interfaces
Oct 23, 2026
Merged

zackees merged 4 commits into
masterfrom
infra/1869-qt-sdk-interfaces

Conversation

@zackees

@zackees zackees commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Scope

Fixes #1869 (the next unit of #1332 from the #1868 handoff). CMake remains authoritative; this does not complete #1332.

  • OBS_QT_TARGET_PREFIX selects the target Qt SDK; OBS_QT_HOST_PREFIX selects the SDK whose moc/uic/rcc run on the host (libexec/ on Unix hosts, bin/*.exe on Windows). OBS_QT_MOC/UIC/RCC still override per tool. Inputs are read only; nothing mutates the process environment.
  • Cross builds without explicit SDKs fail instead of letting ambient host pkg-config select host Qt libraries or tools. Native builds without inputs keep the existing pkg-config path.
  • qt::Sdk reads the SDK's own exported CMake targets as data (CMake is not run) and resolves the Qt6:: closure of a module: include dirs, definitions, compile options (MSVC -Zc:__cplusplus -permissive- -utf-8, UNICODE, WIN32/WIN64), link artifacts and Qt's exported system libraries/frameworks. Only the generator expressions Qt exports are evaluated; any other fails.
  • Validation before compiling: target architecture from ELF/PE/Mach-O headers (every universal slice), Qt 6 from qconfig.h, host tool --version equals the SDK release, configuration/CRT (Windows DEBUG-only SDKs and crt-static are rejected, since Rust's MSVC targets link the release CRT; AdditionalTargetInfo aliases are ignored).
  • Linux: versioned libQt6*.so + rpath. Windows: lib/Qt6*.lib import libraries, DLL directory as the graph's PATH runtime prepend. macOS: framework binaries, Qt's frameworks (deduplicated), rpath to the frameworks' directory. Target rules live in src/platform/qt_sdk.rs.
  • libobs::add_package and Dependency::package route Qt6<Module> packages through the resolver when a target prefix is given.

RED → GREEN

  • RED 18b0fda: seven contracts in the existing obs-tests-app binary (new qt_sdk module, no new executable) against todo!() stubs: 6 failed (not yet implemented); the published-SDK case was added with GREEN.
  • During GREEN, the real published Windows SDK failed: Qt6::Core has no RELEASE configuration (Qt's Qt6CoreAdditionalTargetInfo.cmake declares alias configurations). The Windows fixture now carries that file; with it and the old scan, the two Windows cases failed; the fix reads only Qt6<M>Targets-<config>.cmake.
  • GREEN 8f3e7e2: qt_sdk:: 7 passed.

End-to-end RED/GREEN in the Linux validation image (obs-rust-linux-validate), with the prebuilt obs-studio-libs qt6-6.11.1 Linux SDK mounted, OBS_QT_TARGET_PREFIX set and PKG_CONFIG_LIBDIR exposing only cmocka.pc (no Qt visible to pkg-config):

  • master (git archive origin/master): native_test_graph_generates_qt_metaobjects and canonical_remux_queue_runs_unchanged fail: native dependency Qt6Core/Qt6Widgets: pkg-config ... not found.
  • this branch: both pass, so real moc/uic/rcc generation, metaobject invocation, UI properties, embedded resources and the unchanged remux queue test compile and run through Cargo (explicit SDK) and CMake (CMAKE_PREFIX_PATH = same SDK). 9 passed total with qt_sdk::.

Published SDK resolution (qt_sdk_resolves_published_sdks, extracted archives via OBS_QT_TEST_{LINUX,WINDOWS,MACOS}_PREFIX):

x86_64-unknown-linux-gnu: Qt 6.11.1 RELEASE
x86_64-pc-windows-msvc: Qt 6.11.1 RELWITHDEBINFO
aarch64-apple-darwin: Qt 6.11.1 RELEASE
x86_64-apple-darwin: Qt 6.11.1 RELEASE

Validation

  • ./lint: ok. Clippy -D warnings for obs-build/obs-studio-rust with libobs-integration: clean.
  • Qt is not built anywhere; SDKs come only from obs-studio-libs releases.
  • Tiers: Tier 1 (fixtures + published SDKs) and the existing Qt graph/remux tests through both consumers. Tier 2/3 do not apply (build tooling; no C behavior changed). No C tests, public headers, workflows, worktrees or new test executables. The unrelated local plugins/obs-browser mismatch is excluded.

Not covered (reported, not claimed)

Compiling and running against the Windows and macOS SDKs on those hosts (CI's Windows/macOS Rust lanes have no Qt; they run the fixture contracts; follow-up #1878), Windows ARM64 and MinGW Qt, and distribution multiarch layouts as explicit prefixes (they stay on native pkg-config). Remaining #1332 parent work (full application graph, packaging, cache measurements, saved-profile runtime proof, CMake retirement) is untouched.

@zackees
zackees added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
@zackees
zackees force-pushed the infra/1869-qt-sdk-interfaces branch from 72393ad to a85a82b Compare October 23, 2026 04:23
@zackees

zackees commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Ejected from the merge queue: merge-group Fast Gate failed native_test_graph_replaces_legacy_utility_definitions (core partition 140 targets, expected 139). Cause is on master, not this PR: #1879 added test_qsv_probe to test/cmocka/build/test-graph.json without updating the count, and the graph contract only runs when rust/obs-build changes. Reproduced with ci/local_gate.py --test-diff on the merge-group commit ce08ab3. Rebased onto origin/master 8fd9ae3 and added a85a82b (count 139 → 140, doc inventory 161 targets). --test-diff origin/master and ./lint pass locally. Commits after rebase: RED dc37da0, GREEN 908eb10, 60c6cf7, 73156e5.

@zackees
zackees added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
@zackees

zackees commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Ejected again for the same reason: #1883 added another cmocka target to test-graph.json (core 141, expected 140) while this PR was queued. Rebased onto f948723 and updated the count. Root cause (graph-count contract not run when test/cmocka changes) is filed separately so it stops recurring.

@zackees

zackees commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Merge queue marked this UNMERGEABLE: #1896 and #1875 (ahead in the queue) edit the same graph-count line in native.rs. #1896 already fixes the #1879/#1883 counts, and #1892 (merged) now runs that contract on test/cmocka changes. So I dropped my two count-only commits; this PR no longer touches native.rs. Rebased on 6aec1c3; ./lint and qt_sdk:: (7) pass.

@zackees
zackees removed this pull request from the merge queue due to a manual request Oct 23, 2026
@zackees

zackees commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Correction to the comment above: the first push was rejected because the PR was still queued. I dequeued it and the push has now landed (24f5817). I'll requeue it once PR CI is green.

@zackees
zackees force-pushed the infra/1869-qt-sdk-interfaces branch from b720c2f to 24f5817 Compare October 23, 2026 05:29
Fixture SDKs reproduce the exported CMake targets and binary headers of the
obs-studio-libs Qt 6.11.1 Linux, Windows and macOS archives. All six cases
fail on todo!() stubs.
)

OBS_QT_TARGET_PREFIX and OBS_QT_HOST_PREFIX select the target Qt SDK and
its host tools. qt::Sdk evaluates the SDK's exported CMake targets as data
for the Cargo target (Core/Gui/Widgets closure, definitions, MSVC options,
import libraries, frameworks, rpaths and the Windows DLL runtime path) and
validates architecture, Qt 6 version, tool/SDK release and CRT before
anything compiles. Cross builds no longer fall back to host pkg-config.

The published obs-studio-libs Windows SDK exports alias configurations in
AdditionalTargetInfo; only Targets-<config> files are read (RED fixture
added in this commit, reproducing the real-SDK failure).
${_IMPORT_PREFIX} substitution produced mixed separators on Windows
(C:\t/lib/Qt6Core.lib), so link arguments, rpaths and PATH prepends did not
match the paths Windows reports. Tests compare normalized paths.
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: resolve explicit Qt SDK interfaces for Cargo native builds

1 participant