CNA-BUG-197: cmake/toolchains/mingw-w64.cmake falls back to the i686 compiler but keeps CMAKE_SYSTEM_PROCESSOR x86_64, so the persistent SDL install key mislabels a 32-bit build

CNA snapshot 009d40f5  ·  Known Issues › Current bugs  ·  source links pinned to 009d40f5

✓

Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit 009d40f5; 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 becomes part of the .sdl-prebuilt-Windows-x86_64 cache key; its header comment also still requires a pre-built SDL on CMAKE_PREFIX_PATH.

Identifier
CNA-BUG-197
Category
Bug
Subsystem
Build & CI
Status
Open
Verified against
CNA 009d40f5 (009d40f5dd085c4e674d3479675fac84b12b3e0a)
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 a real 64-bit cross build uses, so either can pick up the other's SDL. 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 009d40f5; nothing was built or executed for this entry. The consequence (a mismatched SDL install being reused and failing at link time) follows from the key but was not observed.

Focused reproduction

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

Current tests

None; the toolchain file has no test.

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; standard x86_64 cross builds 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