CNA-BUG-197: cmake/toolchains/mingw-w64.cmake falls back to the i686 compiler but keeps CMAKE_SYSTEM_PROCESSOR x86_64, so 32-bit and 64-bit trees share one persistent SDL install directory

CNA snapshot 3b43bd86  ·  Known Issues › Current bugs  ·  source links pinned to 3b43bd86

✓

Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit 3b43bd86; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.

When x86_64-w64-mingw32-gcc is missing the toolchain silently selects i686-w64-mingw32 yet still declares x86_64, which names the .sdl-prebuilt-Windows-x86_64 install; since the SDL build manifest records the compiler, the two trees no longer reuse each other's SDL but rebuild that one install in turn. Its header comment also still requires a pre-built SDL on CMAKE_PREFIX_PATH.

Identifier
CNA-BUG-197
Category
Bug
Subsystem
Build & CI
Status
Narrowed (partially fixed; describes only what survives)
Verified against
CNA 3b43bd86 (3b43bd8687ed46523d873f9bec4b32bd8481dcb5)
Severity
Low (a triage suggestion, not a project priority)
Evidence basis
Source-verified: read at TARGET, not executed
Tests touching this area
None
Affected contract
cmake/toolchains/mingw-w64.cmake (MinGW-w64 cross toolchain file)

Expected behaviour

A toolchain file should either target the architecture it declares or fail. ThirdPartySDL.cmake keys its persistent SDL install by ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR} precisely so that differently targeted builds cannot reuse one another's SDL.

Actual behaviour at TARGET

The toolchain sets CMAKE_SYSTEM_PROCESSOR x86_64 unconditionally, then picks i686-w64-mingw32 when x86_64-w64-mingw32-gcc is not found. A host with only the 32-bit MinGW compilers therefore builds a 32-bit tree whose SDL install is keyed Windows-x86_64 - the same key, and so the same install directory, as a real 64-bit cross build. Since 9bb8beb29, 01a59fdd9 and 2e98818e5 (2026-10-26 dependency audit C-09) the SDL build manifest (SdlPrebuiltFingerprint.cmake) also records the toolchain file's content, the compiler it resolved to and the settings it decided, read by SdlToolchainSettings.cmake in a cmake -P evaluation, so a tree whose compiler differs no longer reuses the other's SDL: it finds the manifest changed and rebuilds the shared install in place. A 32-bit and a 64-bit tree therefore rebuild it in turn, and CNA records that such a shared install can change under the other tree's running build (handoff.md section 5.2). The header comment still tells the user to put pre-built SDL3/SDL3_image/SDL3_mixer on CMAKE_PREFIX_PATH, although the vendored SDL is built for the target at configure time into that keyed install.

Source locations

Evidence

Checked by reading the named sources at 3b43bd86; nothing was built or executed for this entry. The consequence follows from the key and the manifest but was not observed.

Narrowed at 3b43bd86: the toolchain file is unchanged. ThirdPartySDL.cmake passes COMPILER and SETTINGS to cna_sdl_build_manifest, pinned by case 16b of cmake/Tests/SdlPrebuiltFingerprint.cmake (CTest CnaSdlPrebuiltFingerprint), so the silent reuse this entry first described became a rebuild of the shared install; the mislabelled key and the stale header comment remain. Not executed.

Focused reproduction

No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.

Current tests

None for the toolchain file. The manifest's capture of a toolchain's settings is tested (CnaSdlPrebuiltFingerprint, case 16b); the i686 fallback is not.

Regression test

Make the fallback set CMAKE_SYSTEM_PROCESSOR to i686 (or fail with a clear message), and a configure-only check that the SDL key contains the compiler's real target.

Blast radius

Linux hosts that have only the i686 MinGW compilers installed: their tree shares the Windows-x86_64 install with any real 64-bit cross tree of the same checkout, and the two rebuild it whenever the other has configured. Standard x86_64 cross builds on their own are unaffected.

Workaround

Install the x86_64 MinGW-w64 compilers, or pass a distinct CNA_SDL_PREBUILT_ROOT.

The same subject is explained at several altitudes. These are the neighbouring pages at each one.

Known issues
Bug index