Skip to content

Build the C oracle and libobs util with GCC for Windows - #431

Merged
zackees merged 3 commits into
masterfrom
fix/291-windows-gnu-oracle
Oct 13, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/291-windows-gnu-oracle

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Closes #291.

On a x86_64-pc-windows-gnu (MinGW) toolchain no test binary linked. I reproduced it from Linux with soldr's mingw-w64 GCC 15.3 cross toolchain, and found four gaps:

Gap Fix
util/threading.h included threading-windows.h (MSVC intrinsics __iso_volatile_load32, _InterlockedExchange8) on every _WIN32 Select it by _MSC_VER (clang-cl defines it too). Other compilers use threading-posix.h, which is only the compiler __atomic builtins
util/buffered-file-serializer.c defined min/max only #ifndef _WIN32, relying on MSVC's <stdlib.h> macros Define them unless those macros exist
obs-c-oracle/build.rs used deps/w32-pthreads only when the compiler is MSVC Use it whenever the target is Windows
Oracle test_stubs.c made os_oom/os_breakpoint weak on non-MSVC; MinGW drops weak-only definitions from static archives, and Windows has no Rust shim for them Strong on every _WIN32

The threading.h change was approved by the maintainer on the issue thread. MSVC and clang-cl builds take exactly the same path as before.

  • RED: the rust-test lane also runs soldr cargo test --workspace --locked --no-run --target x86_64-pc-windows-gnu. rust-toolchain.toml adds that target so rustup installs it. On master's code this fails in the oracle build.
  • GREEN: with the four fixes, all 135 workspace test binaries link for x86_64-pc-windows-gnu. They aren't run (no Wine), so this guards the build and link, not test results on MinGW.

The local gate (lint, rust-test with the cross build, Tier 2 OFF/ON) passed and is stamped.

…RED)

A GCC-based Windows toolchain can't build the C oracle today: it gets
the MSVC threading header, the MSVC-only min/max assumption and the
weak os_oom/os_breakpoint stubs.

Refs #291
- util/threading.h: threading-windows.h is MSVC intrinsics, so pick it
  by _MSC_VER; MinGW gets the compiler __atomic builtins.
- util/buffered-file-serializer.c: define min/max unless the MSVC
  <stdlib.h> macros exist, instead of on every _WIN32.
- obs-c-oracle build.rs: w32-pthreads by target (Windows), not compiler.
- oracle test_stubs.c: strong os_oom/os_breakpoint on every Windows
  target; MinGW drops weak-only definitions from static archives.

Every workspace test binary now links for x86_64-pc-windows-gnu.

Closes #291

Local-Gate: v1 tree=bddbac456889d9085fa86ab6743c22f3cd536613 secs=256 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791858737,"gate":"rust/all/fmt","host":"linux-x86_64","key":"b41dbb491bd0eb732f6f8d3b31b6a438b7bbf5decdd105d2bd78969648ca745e","lane":"lint","parents":["c17953e0101943fd2199765f1712edbc1cb2111e"],"secs":28,"stamp":"1e9da3662a07466bc43f05cb106d5c25","tree":"bddbac456889d9085fa86ab6743c22f3cd536613","v":1,"via":"run"}
Ci-Attestation: {"at":1791858737,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"b41dbb491bd0eb732f6f8d3b31b6a438b7bbf5decdd105d2bd78969648ca745e","lane":"lint","parents":["c17953e0101943fd2199765f1712edbc1cb2111e"],"secs":28,"stamp":"9e04dfa34bdf1e0b597e290685a2fcb0","tree":"bddbac456889d9085fa86ab6743c22f3cd536613","v":1,"via":"run"}
Ci-Attestation: {"at":1791858737,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"2b9bb018c84941528450affe914f9dde87430a4b1ead73864baa0d34f739fd2a","lane":"rust-test","parents":["c17953e0101943fd2199765f1712edbc1cb2111e"],"secs":113,"stamp":"ce5f97aab981596456d5e6860fb7ecef","tree":"bddbac456889d9085fa86ab6743c22f3cd536613","v":1,"via":"run"}
Ci-Attestation: {"at":1791858737,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"7cfebc9c79798ada12afdf61bfd5372afedb5ca116db1922ff10dc0b7bcaf1d1","lane":"tier2-linux","parents":["c17953e0101943fd2199765f1712edbc1cb2111e"],"secs":114,"stamp":"1d74a9485a3de6574984c69bc510ea4f","tree":"bddbac456889d9085fa86ab6743c22f3cd536613","v":1,"via":"run"}
Listing it under [toolchain] targets made soldr on the Windows runner
build and run the whole test suite as x86_64-pc-windows-gnu, where
profiler_parity crashes (a separate MinGW runtime issue).

Refs #291

Local-Gate: v1 tree=56a412e99eceeaffd0c6cdd2ff29529c89895778 secs=271 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791861790,"gate":"rust/all/fmt","host":"linux-x86_64","key":"fe474cad64032fe3ec10ae4691f54e8c49225610cae8221e9347aad1268ff3d5","lane":"lint","parents":["bab2092f5ae30199fdcea5cf97494866e72d529f"],"secs":78,"stamp":"c496fe4fd1e3b6a5463b89386ce07548","tree":"56a412e99eceeaffd0c6cdd2ff29529c89895778","v":1,"via":"run"}
Ci-Attestation: {"at":1791861790,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"fe474cad64032fe3ec10ae4691f54e8c49225610cae8221e9347aad1268ff3d5","lane":"lint","parents":["bab2092f5ae30199fdcea5cf97494866e72d529f"],"secs":78,"stamp":"70624bf9927503a2cd85c55c4430e4c0","tree":"56a412e99eceeaffd0c6cdd2ff29529c89895778","v":1,"via":"run"}
Ci-Attestation: {"at":1791861790,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"86bb0d707d0a503568ff62156e4ee839421a63facfa9099d761bc2ae4acdf5a1","lane":"rust-test","parents":["bab2092f5ae30199fdcea5cf97494866e72d529f"],"secs":124,"stamp":"18dd9fa51f2ba10bcd9c686aa15f8c3e","tree":"56a412e99eceeaffd0c6cdd2ff29529c89895778","v":1,"via":"run"}
Ci-Attestation: {"at":1791861790,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"48b7392422fad28aef676a237feac4ab6c382846139e1e0199cd3608eef4a6de","lane":"tier2-linux","parents":["bab2092f5ae30199fdcea5cf97494866e72d529f"],"secs":69,"stamp":"5a68367c97a4620918eab0eb920f3b5a","tree":"56a412e99eceeaffd0c6cdd2ff29529c89895778","v":1,"via":"run"}
@zackees
zackees force-pushed the fix/291-windows-gnu-oracle branch from 1a295fb to 0080625 Compare October 13, 2026 03:23
@zackees

zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

The Windows Rust Tests failure was caused by this PR. With x86_64-pc-windows-gnu under [toolchain] targets, soldr on the Windows runner built and ran the whole suite as windows-gnu, and profiler_parity crashed there (STATUS_ACCESS_VIOLATION). The new commit drops it from rust-toolchain.toml; the gate lane runs soldr rustup target add before its --no-run cross build instead, so the Windows CI job is MSVC again. The MinGW runtime crash is filed separately; this PR only claims build and link.

@zackees
zackees merged commit ea3df88 into master Oct 13, 2026
23 checks passed
zackees added a commit to rdoupe/obs-studio that referenced this pull request Oct 13, 2026
obs-rust#420 (video-io port) and obs-rust#431 (windows-gnu --no-run link in the
rust-test lane) merged within minutes, and together the lane failed on
master: obs-media-io's video_io test didn't link.

- The video-io oracle's obs_get_profiler_name_store/profile_store_name
  stand-ins were weak on every non-MSVC Windows target, where the audio
  oracle's strong copies don't exist; MinGW drops weak-only definitions
  from static archives. Strong on every _WIN32 now.
- GNU ld scans archives once, in order, and rustc put the oracle's rlib
  before obs_util and obs_media_io, which call into it. The lane links
  through the toolchain's lld (rustlib/<host>/bin/gcc-ld) instead.

Refs obs-rust#291
@zackees
zackees deleted the fix/291-windows-gnu-oracle branch October 26, 2026 15:44
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.

bug: obs-c-oracle: no test binary links on a Windows GNU/gnullvm host (pthread comes from the compiler branch, not the target)

1 participant