From a7c580a046ca2705ef7921520498636915207346 Mon Sep 17 00:00:00 2001 From: arekbr Date: Wed, 5 Aug 2026 07:07:26 +0200 Subject: [PATCH] fix: Windows CI -- pin windows-2022, new image's clang-cl 22 breaks bundled SDL header The Windows job dies compiling MTEngineSDL: SDL_endian.h(40,1): error : definition of builtin function '_m_prefetch' What changed: nothing in either repo. The windows-2025-vs2026 runner image was updated between the last green run (June, image 20260608 with clang-cl 20.1.8) and now (image 20260728 with clang-cl 22.1.3). Since clang 21, _m_prefetch is a compiler builtin, and the SDL 2.28.5 header bundled in MTEngineSDL redefines it under a plain '#ifdef __clang__' (an old Clang-11-vs-winnt.h workaround). There were no CI runs between June and the #114/#115 merges, so the failure surfaced on the first push after the image update -- the merged PRs touch neither MTEngineSDL nor the workflow. This pin buys a working CI: windows-2022 ships VS 2022 (clang-cl 19.x) and is servicing-only, so its clang will stay below 21. The proper fix lives in MTEngineSDL's bundled header and mirrors what upstream SDL2 did (their branch, not yet in any release): -#ifdef __clang__ +#if defined(__clang__) && !_SDL_HAS_BUILTIN(_m_prefetch) (with the underscore: _SDL_HAS_BUILTIN is the SDL2 spelling; upstream's first attempt used the SDL3 name and did not compile, fixed in their follow-up). Safe for older toolchains: clang 11-20 report no such builtin, so the workaround stays for them. Happy to send that PR to MTEngineSDL if wanted -- then this pin can go back to windows-latest. --- .github/workflows/build-windows.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 06da86d9..87f2f7a2 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -9,7 +9,16 @@ on: jobs: build-windows: - runs-on: windows-latest + # Pinned: windows-latest now resolves to the Windows Server 2025 / VS 2026 + # image, whose bundled clang-cl is >= 21 and defines _m_prefetch as a builtin. + # MTEngineSDL's bundled SDL 2.28.5 header (SDL_endian.h) redefines it under + # plain "#ifdef __clang__", which is now a hard error: + # SDL_endian.h(40,1): error : definition of builtin function '_m_prefetch' + # windows-2022 ships VS 2022 (clang-cl 19.x, servicing-only, so it will stay + # < 21). The proper fix is upstream SDL's one-line guard change in the + # bundled header (MTEngineSDL repo); once that lands, this pin can go back + # to windows-latest. + runs-on: windows-2022 steps: - name: Checkout RetroDebugger