Repository navigation
build(cross): link a shared libobs per alias with OBS_CROSS_LINK (#3059) - #3123
Merged
Merged
Conversation
…#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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
-DOBS_CROSS_LINK=ONturns the compile-only cross check (cmake/cross) into areal 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=ONcould not link at all before this branch:lld-link: duplicate symbol: blogva— the link set has to be the shippedhybrid's (
LIBOBS_SOURCES+ host sources +LIBOBS_RUST_SOURCES);bfree,bmalloc,obs_data_array_*,obs_hotkey_*,calldata_set_data,signal_handler_signal, …) wereundefined until the
libobs-ruststaticlib was linked;MSVCRT.lib/OLDNAMES.libwere unopenable: the xwin SDK shipsmsvcrt.lib/oldnames.lib, and the Rust objects ask for the Windows case;OBS::obfuscatewere not in the link at all;
_mm_set_ps/_mm_setzero_pswere undefined: the xwin headers declare themextern(MSVC recognizes them as intrinsics), and clang for the same targetemits calls.
GREEN
All three aliases now link. Measured on this host (soldr 0.9.47, xwin SDK
2026-06-22, Apple SDK 14.5):
win-x64build_cross_win-x64/obs.dllmac-arm64build_cross_mac-arm64/obs.dylibmac-x64build_cross_mac-x64/obs.dyliblibobs/cmake/rust-exports.dis exported from the WindowsDLL (
/EXPORT:, aslibobs/cmake/rust-os-windows.cmakedoes); verified withllvm-readobj --coff-exports(824/824).are Windows-only:
get_dll_ver,get_win_ver,is_64_bit_windows, …), andimport the same FFmpeg dylibs and frameworks as the native build.
w32-pthreadsis a separatew32-pthreads.dll+.lib, matchingdeps/w32-pthreads'SHAREDtarget.-DOBS_CROSS_TARGET=win-x64configure+buildis 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, notFixes.Notes for review
cmake/cross/xwin-sse-shims.cexists only for the Windows cross link: thexwin CRT's
xmmintrin.hdeclares the MSVC intrinsicsexternand clang doesnot 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_LINKbuilds the staticlib withsoldr cargo build --release --target <triple> -p libobs-rustas a custom command, so CI's compile-onlylane is unaffected.
ci/test_soldr_cross_toolchain.pygained three invariants: the lane staysoff 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.