cmake(windows): accommodate for Git for Windows' migration to UCRT64
PATCH 1/1 cmake(windows): accommodate for Git for Windows' migration to UCRT64
From: Johannes Schindelin <[email protected]>
Git for Windows needs to ship with a lot of Unix tools that Git takes for granted, such as sed, awk, a C compiler and a Unix shell, just to name a few. In Git for Windows, these are provided by the MSYS2 project.
Part of these tools (such as bash.exe) use a POSIX emulation layer ("MSYS2 runtime", a friendly fork of the Cygwin runtime), but others target a native Win32 toolchain, e.g. git.exe. There are multiple flavors of that toolchain, and historically Git for Windows used MINGW64 on x64 Windows. This toolchain uses the old MSVC runtime, and therefore the MSYS2 project deprecated it.
As a consequence, Git for Windows switches to UCRT64 with v2.56.0. That flavor still uses GCC to compile native Win32 binaries, but targets the Universal C Runtime ("UCRT"). Internally, this means that the new git.exe is installed into a new prefix, /ucrt64/, whereas the old git.exe was installed into /mingw64/.
A recently-upstreamed commit hard-codes this expectation even into the CMake-based build, so that the built git.exe "knows where it lives" and can ensure that the tools it expects on the PATH are found.
Naturally, this hard-coded MINGW64 needs to change to UCRT64 now, too.
---
cmake(windows): accommodate for Git for Windows' migration to UCRT64
I could not squash this patch into the previous patch series (merged via bca240abc334 (Merge branch 'js/mingw-build-updates', 2026-09-11)) because that patch series was supposed to be merged into Git's master before the MINGW64 -> UCRT64 migration completed, to allow for that migration to go forward without breaking Git's CI builds, whereas this here patch is only correct after that migration. I completed that migration (see https://github.com/git-for-windows/git-sdk-64/pull/117)
on September 10th, 2026, so now I can send this follow-up.
Technically, it would not be required in core Git (because it skips the vs-build CI job), but it is required in git-for-windows/git (because it does not skip that CI job).
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2228%2Fdscho%2Fadapt-cmake-after-the-mingw-to-ucrt64-migration-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2228/dscho/adapt-cmake-after-the-mingw-to-ucrt64-migration-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2228
contrib/buildsystems/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/buildsystems/CMakeLists.txt +1 -1
@@ -258,7 +258,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP HAVE_WPGMPTR HAVE_RTLGENRANDOM) if(CMAKE_GENERATOR_PLATFORM STREQUAL "x64") - add_compile_definitions(ENSURE_MSYSTEM_IS_SET="MINGW64" MINGW_PREFIX="mingw64") + add_compile_definitions(ENSURE_MSYSTEM_IS_SET="UCRT64" MINGW_PREFIX="ucrt64") elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "arm64") add_compile_definitions(ENSURE_MSYSTEM_IS_SET="CLANGARM64" MINGW_PREFIX="clangarm64") elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x86")
base-commit: 47ce80527c56f462cb97db4ca8125342204d3783
Signature · 1 line
gitgitgadget