Skip to content

build(cross): resolve the cross toolchain through soldr cc --print-* (#3059) - #3091

Merged
zackees merged 2 commits into
masterfrom
infra/3059-soldr-cc-toolchain
Oct 30, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/3059-soldr-cc-toolchain

Conversation

@zackees

@zackees zackees commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What

The cross check (cmake/cross, #1075) compiled for win-x64/mac-arm64/mac-x64 with a
toolchain that cmake/common/soldr.cmake assembled by walking soldr's install layout —
bin/llvm-*/hardlinked/bin/clang, bin/apple-sdk/*/darwin-<arch>/package/sdk,
sdk/x86_64-pc-windows-msvc/xwin/*/xwin — because soldr had no C-compiler interface for these
triples when it was written (the # TODO(soldr cc --target) comment).

soldr 0.9.45 has that interface (#3042), so this switches to it:

  • obs_soldr_cross_toolchain() asks soldr cc --target <triple> --print-cc/--print-cxx/ --print-linker/--print-sysroot/--print-ar/--print-rc for every tool and writes those paths
    into the generated toolchain file. soldr provisions the target's LLVM, linker and SDK on first
    use, so the "run rustup target add and link a crate to make soldr fetch them" workaround goes.
  • The explicit clang target and the hand-written MSVC -idirafter SDK include list go too:
    soldr's cc driver is already targeted and carries the target's sysroot, include and link flags
    (it compiles <windows.h>, <TargetConditionals.h> and the Qt private headers unchanged).
  • --print-rc gives the real resource compiler (llvm-rc) instead of the ${CMAKE_COMMAND}
    placeholder CMake's Windows-Clang platform needed.
  • --print-ar is llvm-lib on the MSVC targets, which speaks lib.exe syntax (/out:), while
    CMake drives this driver in its GNU-like mode (the executable is named *-clang, not
    clang-cl), whose archive rule is ar qc. The archiver is llvm-ar from the same LLVM soldr
    printed; llvm-lib is left documented for the link step this issue adds next.

ci/test_soldr_cross_toolchain.py pins the class: the tool names come from those printers, and
none of the layout strings (/hardlinked/, apple-sdk/, xwin/, soldr status,
rustup target add, _obs_soldr_locate) may come back.

RED

51033cccd — ci/test_soldr_cross_toolchain.py on origin/master:

uv run python -m unittest ci/test_soldr_cross_toolchain.py
FAIL: ...test_toolchain_is_resolved_through_soldr_cc_printers
AssertionError: function(_obs_soldr_cc_print ...) not found
FAIL: ...test_no_soldr_layout_guessing_remains (guess='/hardlinked/')
FAIL: ...(guess='apple-sdk/')  (guess='xwin/')  (guess='_obs_soldr_locate')
FAIL: ...(guess='soldr status')  (guess='rustup target add')
Ran 3 tests - FAILED (failures=7)

(Replayed against origin/master's cmake/common/soldr.cmake with the committed test file.)

GREEN

34be03a55:

uv run python -m unittest ci/test_soldr_cross_toolchain.py
Ran 3 tests in 0.001s
OK
== lane lint: ok (251.5s)

Real cross check, configured and fully built on this host (no native runner) with the generated
toolchain, after the change:

alias configure build
win-x64 102 s (incl. the one-time deps download) 200 objects, ninja: no work to do on re-run
mac-arm64 20 s 171 objects, exit 0
mac-x64 20 s 241 targets, exit 0

Tiers: Tier 1 is the Python pin. Tiers 2/3/4 do not apply — this is build tooling
(cmake/common/soldr.cmake, cmake/cross/), no C test, public header or product code changes.
No user-visible change, so no docs/features.md line; no Rust tests, so no Test cost line.

Left for this issue

The opt-in OBS_CROSS_LINK that links a shared libobs per alias (and the cold-build numbers
next to the native ones) is the next PR; this one only replaces the unsupported toolchain
discovery with the supported interface. Refs #3059.

RED: cmake/common/soldr.cmake still finds the cross compiler and SDK by
walking soldr's install layout (bin/llvm-*/hardlinked/bin/clang,
bin/apple-sdk/*/darwin-<arch>/package/sdk, sdk/.../xwin/*), because soldr had
no `cc --target ... --print-*` when it was written.

    uv run python -m unittest ci/test_soldr_cross_toolchain.py
    Ran 3 tests - FAILED (failures=12)
    AssertionError: '--print-cc' not found in 'function(obs_soldr_cross_toolchain ...'
    AssertionError: '/hardlinked/' unexpectedly found in ...

Refs #3059
#3059)

GREEN: obs_soldr_cross_toolchain() no longer walks soldr's install layout
(bin/llvm-*/hardlinked/bin/clang, bin/apple-sdk/*/darwin-<arch>/package/sdk,
sdk/x86_64-pc-windows-msvc/xwin/*). It asks soldr for each tool with
`soldr cc --target <triple> --print-cc/--print-cxx/--print-linker/
--print-sysroot/--print-ar/--print-rc`, the interface soldr#2335 shipped, and
writes those paths into the generated toolchain file.

- The clang target, the hand-written MSVC -idirafter SDK include list and the
  "link a small crate to provision LLVM" workaround all go: soldr's cc driver
  is already targeted and carries the target's sysroot, include and link flags.
- `--print-rc` covers the Windows resource compiler (llvm-rc); the placeholder
  ${CMAKE_COMMAND} CMAKE_RC_COMPILER is gone.
- `--print-ar` is llvm-lib on the MSVC targets, which speaks lib.exe syntax
  while CMake drives this driver in GNU-like mode (`ar qc`); the archiver is
  llvm-ar from the same LLVM soldr printed, and llvm-lib stays documented as
  the tool the later link step needs.

Local: `uv run python -m unittest ci/test_soldr_cross_toolchain.py` -> OK.

Cross check, real tree, configured and built on this host with the new
toolchain (no native runner):

| alias | cmake configure | build |
| --- | --- | --- |
| win-x64 | 102 s | 200 objects, clean |
| mac-arm64 | 20 s | 171 objects, clean |
| mac-x64 | 20 s | 241 targets, clean |

Tier 2/3/4 do not apply: cmake/common/soldr.cmake and cmake/cross/ are build
tooling, and no C test or public header changes.
@zackees
zackees marked this pull request as ready for review October 30, 2026 18:26
@zackees
zackees added this pull request to the merge queue Oct 30, 2026
@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

  • Every lane this change selects is green on 34be03a55: Cross Compile 🧰 (mac-arm64,win-x64) 5m31s, Fast Gate ⚡ 2m25s, Rust Tests 🦀 macOS/Windows, Rust Tier 2 macOS/Windows, Cross Lint 🦀 (Windows, macOS), CI Gate ✅.
  • Local: uv run python -m unittest ci/test_soldr_cross_toolchain.py OK, ./lint ok (251.5 s), and the real cross tree (all three aliases) configured and built on this host with the generated toolchain — the table is in the body.
  • No local-gate stamp: the PR CI run above is the gate.

Merged via the queue into master with commit 48ce1c0 Oct 30, 2026
36 checks passed
@zackees
zackees deleted the infra/3059-soldr-cc-toolchain branch October 30, 2026 18:45
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