Files
godot-ci/docs/research/mingw-w64-alpine.md
T
haylan 2bfbffd5c5 docs(research): investigate mingw-w64 availability on Alpine
Answers wayfinder issue #6: Alpine's community/edge repo ships a
posix-threads-only mingw-w64-gcc cross toolchain, but it's edge-only
(not in a stable release) and no primary source confirms anyone has
built Godot Windows export templates with it.

Related to #6
2026-08-06 22:37:29 +02:00

7.7 KiB

Is a working mingw-w64 toolchain available on Alpine?

Verdict

Available, and it is posix-threads by default with no win32 alternative — Alpine Linux's community repo ships a real mingw-w64 GCC cross-toolchain (mingw-w64-gcc, x86_64-w64-mingw32-* binaries) built with --enable-threads=posix baked in at build time. There is no update-alternatives-style choice the way Debian/Ubuntu offer it: Alpine only ever produces the posix-thread build, so no extra step is needed to select it. The one caveat: the package currently only exists on Alpine's edge branch, not on a tagged stable release, and no primary source confirms anyone has actually built Godot's Windows export templates with it.

Details

1. Exact Alpine package name(s)

Confirmed via the Alpine package index (https://pkgs.alpinelinux.org/packages) and the aports source tree (https://gitlab.alpinelinux.org/alpine/aports, mirrored at https://github.com/alpinelinux/aports):

Package Version seen Repo/branch Arch Notes
mingw-w64-gcc 15.2.0-r0 community, edge only x86_64 The cross-compiler itself: provides x86_64-w64-mingw32-gcc, -g++, -cc, -c++, -cpp, -gcov, -ar, -nm, -ranlib, LTO tools, etc. (13 binaries). https://pkgs.alpinelinux.org/package/edge/community/x86_64/mingw-w64-gcc
mingw-w64-gcc-base 15.2.0-r0 community, edge x86_64 https://pkgs.alpinelinux.org/package/edge/community/x86/mingw-w64-gcc-base
mingw-w64-gcc-ccache 15.2.0-r0 community, edge x86_64 ccache-wrapped variant
mingw-w64-binutils 2.45.1-r0 community, edge x86_64 as, ld, etc. for the mingw target
mingw-w64-crt 14.0.0-r0 community, edge x86_64 Windows C runtime
mingw-w64-headers (+ -bootstrap, -doc) 14.0.0-r0 community, edge x86_64 Windows API headers
mingw-w64-winpthreads (+ -doc) 14.0.0-r0 community, edge x86_64 pthreads-for-Windows implementation, required dependency of mingw-w64-gcc
i686-mingw-w64-gcc / i686-mingw-w64-binutils community, edge x86_64 32-bit target cross-toolchain

All maintained by Simon Zeni. Source: https://pkgs.alpinelinux.org/packages?name=mingw* (searched "mingw"), and per-package pages linked above.

Caveat on availability: querying the package index without pinning a branch, and per-package pages, show these packages only under the edge branch (Alpine's rolling/unstable repo), not under a versioned stable branch (e.g. v3.20, v3.21) at time of research (2026-08-06). If godot-ci's Dockerfile were ever based on Alpine, it would need edge's community repo enabled (or a specific stable release once/if the package gets backported) — this is a meaningfully different posture than Debian, where mingw-w64 is in every stable suite.

2. Thread model: posix-only, no win32 alternative

Fetched the APKBUILD build recipe directly from the aports source (https://raw.githubusercontent.com/alpinelinux/aports/master/community/mingw-w64-gcc/APKBUILD, mirroring https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/mingw-w64-gcc/APKBUILD): the GCC configure invocation includes --enable-threads=posix explicitly, with no companion win32-thread-model package or build variant anywhere in the mingw-w64 package set.

This is corroborated structurally by the package index: mingw-w64-gcc has mingw-w64-winpthreads (the pthreads-for-Windows library) as a hard dependency (https://pkgs.alpinelinux.org/package/edge/community/x86_64/mingw-w64-winpthreads lists mingw-w64-gcc as a reverse-dependency). winpthreads is only linked in for the posix thread model — a win32-thread-model GCC wouldn't need it.

So: Alpine does not offer a choice the way Debian does (x86_64-w64-mingw32-gcc-posix vs -win32 selected via update-alternatives). There is exactly one x86_64-w64-mingw32-gcc binary on Alpine, and it is already the posix variant — no update-alternatives --set step is needed or possible.

3. Real-world reports of building Godot on Alpine-hosted mingw-w64

  • Godot's own official docs (fetched primary source: https://docs.godotengine.org/es/3.5/_sources/development/compiling/compiling_for_windows.rst.txt, and corroborated by search of the current compiling_for_windows.rst in godotengine/godot-docs) state: "MinGW-w64 with GCC can be used as an alternative to Visual Studio. Be sure to install/configure it to use the posix thread model." They give install commands for Debian/Ubuntu (apt install mingw-w64), Fedora, Arch Linux (AUR), macOS (Homebrew), and Mageia. Alpine Linux is not mentioned anywhere in Godot's official compiling-for-Windows documentation.
  • Godot's own official build-container project, godotengine/build-containers (https://github.com/godotengine/build-containers/blob/main/Dockerfile.windows), builds its Windows cross-compile image from a Debian/Ubuntu-family base with mingw32/mingw64 apt packages — not Alpine.
  • No GitHub issue, forum post, or blog post surfaced in searches (godot alpine mingw-w64-gcc docker windows export template, godot windows export template alpine mingw-w64 build scons cross compile) reporting either a success or a failure building Godot/SCons specifically against Alpine's mingw-w64-gcc. The closest hits were generic Alpine-based mingw-w64 Docker images unrelated to Godot (e.g. portown/alpine-mingw-w64, mmozeiko/container-mingw-w64), and Godot Docker/CI guides that all use Debian/Ubuntu bases.
  • Conclusion: this combination (Godot SCons + Alpine mingw-w64) appears untested/undocumented in public sources — plausible in theory (posix threads, matching GCC 15 > the "GCC 9 or later" minimum Godot's docs state) but unverified in practice.

Recommendation

godot-ci's current Dockerfile (FROM barichello/godot-ci:${GODOT_VERSION}, confirmed Debian/Ubuntu-based via its apt-get install calls) is not on Alpine today, so this question is currently moot for the repo as-is. If a future switch to an Alpine base is considered:

  • Drop the update-alternatives --set x86_64-w64-mingw32-gcc/-g++ ... -posix lines entirely — Alpine's mingw-w64-gcc is posix-threads-only, there is no alternative to select and the update-alternatives binaries/symlinks Debian ships don't exist on Alpine.
  • Pin to Alpine's edge branch (with community repo enabled) for mingw-w64-gcc, since it is not present in a stable Alpine release at time of writing — re-check https://pkgs.alpinelinux.org/packages?name=mingw-w64-gcc before committing to this, as edge-only packages can be less predictable to pin/reproduce in CI than Debian stable.
  • Because no one has publicly documented actually building Godot's Windows export templates against Alpine's mingw-w64-gcc, budget time for a real trial build (SCons platform=windows) before trusting it in CI — treat it as unverified rather than a known-good path.

References