Skip to content

build(cross): link a shared libobs per alias with OBS_CROSS_LINK (#3059) - #3123

Merged
zackees merged 2 commits into
masterfrom
infra/3059-cross-link
Oct 31, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/3059-cross-link

Conversation

@zackees

@zackees zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member

What this adds

-DOBS_CROSS_LINK=ON turns the compile-only cross check (cmake/cross) into a
real link: a shared libobs per alias, built on Linux with no Windows or macOS
runner. It is opt-in and the default stays compile-only.

Part 2 of #3059 (part 1, the soldr cc --target --print-* toolchain, landed in
#3091). Refs #3059 and #697.

RED

OBS_CROSS_LINK=ON could not link at all before this branch:

  • linking the C-reference and the Rust halves together gave
    lld-link: duplicate symbol: blogva — the link set has to be the shipped
    hybrid's (LIBOBS_SOURCES + host sources + LIBOBS_RUST_SOURCES);
  • the Rust halves' shims (bfree, bmalloc, obs_data_array_*,
    obs_hotkey_*, calldata_set_data, signal_handler_signal, …) were
    undefined until the libobs-rust staticlib was linked;
  • MSVCRT.lib / OLDNAMES.lib were unopenable: the xwin SDK ships
    msvcrt.lib / oldnames.lib, and the Rust objects ask for the Windows case;
  • libcaption, the generated version/core-module objects and OBS::obfuscate
    were not in the link at all;
  • _mm_set_ps / _mm_setzero_ps were undefined: the xwin headers declare them
    extern (MSVC recognizes them as intrinsics), and clang for the same target
    emits calls.

GREEN

All three aliases now link. Measured on this host (soldr 0.9.47, xwin SDK
2026-06-22, Apple SDK 14.5):

alias artifact format size exports (incl. Rust shims)
win-x64 build_cross_win-x64/obs.dll PE32+ AMD64 1,171,968 B 1,795 (824 Rust)
mac-arm64 build_cross_mac-arm64/obs.dylib Mach-O arm64 3,994,096 B 5,951
mac-x64 build_cross_mac-x64/obs.dylib Mach-O x86_64 4,013,528 B 5,989
  • Every Rust shim in libobs/cmake/rust-exports.d is exported from the Windows
    DLL (/EXPORT:, as libobs/cmake/rust-os-windows.cmake does); verified with
    llvm-readobj --coff-exports (824/824).
  • The macOS dylibs export every platform-applicable shim (the 7 remaining names
    are Windows-only: get_dll_ver, get_win_ver, is_64_bit_windows, …), and
    import the same FFmpeg dylibs and frameworks as the native build.
  • w32-pthreads is a separate w32-pthreads.dll + .lib, matching
    deps/w32-pthreads' SHARED target.
  • Default-OFF regression: a fresh -DOBS_CROSS_TARGET=win-x64 configure+build
    is green, 991 warnings, same as before this change.

The remaining issue acceptance item is the cold-build number per alias
(no zccache, no unity cache) next to the native step times; this PR does not
claim it, hence Refs, not Fixes.

Notes for review

  • cmake/cross/xwin-sse-shims.c exists only for the Windows cross link: the
    xwin CRT's xmmintrin.h declares the MSVC intrinsics extern and clang does
    not treat the declaration as an intrinsic; the file defines the three the
    link needs. It is added only under OBS_CROSS_LINK + win-x64.
  • OBS_CROSS_LINK builds the staticlib with soldr cargo build --release --target <triple> -p libobs-rust as a custom command, so CI's compile-only
    lane is unaffected.
  • ci/test_soldr_cross_toolchain.py gained three invariants: the lane stays
    off by default, each alias links the production Rust staticlib, and the
    Windows link names the shims.

Test cost: no new Rust tests; the added checks are Python, 6 tests in 0.004 s.

zackees and others added 2 commits October 30, 2026 20:52
…#3059)

Opt-in OBS_CROSS_LINK turns the compile-only cross check into a real link:
a shared libobs for win-x64, mac-arm64 and mac-x64 from Linux. The link set
is the shipped hybrid's (LIBOBS_SOURCES + host sources + LIBOBS_RUST_SOURCES),
plus the libobs-rust staticlib, deps/libcaption, the generated version and
core-module objects, and OBS::obfuscate on Windows. Rust shims are named with
/EXPORT on Windows. The xwin SDK's MSVC intrinsics (_mm_set_ps and friends)
are declared extern and clang calls them, so a small shim defines them for
the cross link.

Default stays OFF; a fresh default configure and build is unchanged.
@zackees
zackees added this pull request to the merge queue Oct 31, 2026
@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator. PR CI is green (CI Gate ✅, Cross Compile ✅ 3m29s); the PR is queued to merge. Refs #3059: the remaining acceptance item is the cold-build number per alias, which is a follow-up slice.

Merged via the queue into master with commit d13f714 Oct 31, 2026
36 checks passed
@zackees
zackees deleted the infra/3059-cross-link branch October 31, 2026 04:43
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