HeadlinesBriefing favicon HeadlinesBriefing.com

Principia Ported Back to Windows XP with Custom Toolchain

Hacker News •
×

Principia, a puzzle game originally released in 2014, ran on Windows XP during its initial launch when mainstream support still existed. After becoming open source, modern toolchains and dependencies like UCRT broke XP compatibility, but developer interest in restoring legacy support led to an ambitious recompilation project targeting Windows XP (NT 5.1).

The main obstacle proved to be the toolchain itself. MSYS2's LLVM-based mingw-w64 couldn't target Windows XP due to libc++ requiring Windows 7+ and linking against UCRT. Building GCC from source with custom settings became necessary, but even GCC 16 presented challenges. The GMP library failed to compile because GCC 15+ defaults to C23, which changed how empty function parameters work, requiring a -std=gnu99 workaround.

Additional patches were needed for libstdc++'s dependency on GetDynamicTimeZoneInformation, a Vista+ API used in std::chrono. A pre-made patch from w64devkit solved this cleanly. The author successfully built a complete cross-compiling toolchain on Linux targeting 32-bit Windows XP, verified working with a simple hello world test in Wine.

Dependency compilation presented further hurdles. While most libraries like SDL, freetype, and zlib proved portable, curl dropped Windows XP support in version 8.19.0. Even curl 8.18.0 failed due to missing freopen_s in msvcrt.dll, forcing a fallback to curl 8.17.0 for the final build.