Crafter.Build/implementations
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf ab998081e1
fix: give the mingw target a sysroot that holds mingw-w64 alone
Inside the Flatpak the mingw-w64 prefix is the host's /usr, and it was
clang's --sysroot as is. clang's mingw driver takes a sysroot for a tree
that holds mingw-w64 alone, and adds its include/ to the include path
and its lib/ to the library path. For /usr those are the Linux system's
own: every header mingw-w64 lacks came from glibc, and libstdc++'s
<ext/atomicity.h>, finding <sys/single_threaded.h>, had shared_ptr read
__libc_single_threaded, which nothing on Windows defines. Every program
that used one failed to link, among them every Crafter.Graphics Win32
executable, through Crafter.Asset's GLB loader. CRAFTER_MINGW_DIR=/usr
did the same outside the Flatpak (#43).

The sysroot is now MingwSysroot(): a directory in the cache, one per
prefix, holding only links to the prefix's x86_64-w64-mingw32/, lib/gcc/
and lib64/gcc/ (where openSUSE keeps gcc). Through it clang finds
mingw-w64, gcc's version and libstdc++ exactly as it does through the
mingw gcc on PATH, and nothing else. It is made by the first mingw
compile, link or CMake configure of a process, so no other command
writes to the cache for it and a failure to make it is that build's
error. The Toolchain field is now mingwPrefix, since clang never gets
the prefix itself, and it is made absolute when the toolchain is
resolved, as it ends up in link targets and directory names. Messages
keep naming paths under the prefix rather than under the view.

The prefix is also part of the mingw target's VariantId and of its std
PCM directory. Units do not track the std PCM they import: when the
fixed release built in a directory a broken build had left, the std
module was rebuilt and the objects compiled against glibc's headers
were only relinked, failing as before. As with a compiler update, a new
directory is what gets them rebuilt. It also keeps two releases that
share a cache, as the Flatpak's branches do, from rebuilding one std PCM
under each other's PCMs, and two prefixes apart. Without a prefix both
stay as they were: clang's own discovery has not changed.

Two shorter ways do not work: --sysroot=<prefix>/x86_64-w64-mingw32
loses the directory gcc's version names, so <string> is not found, and
clang ignores --gcc-toolchain and --gcc-install-dir for this target.

Fixes #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 20:48:06 +01:00
..
Crafter.Build-Agents.cpp feat(agents): write AGENTS.md from a tracked AGENTS.template.md 2026-10-31 16:53:42 +01:00
Crafter.Build-Asset.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Clang.cpp fix: give the mingw target a sysroot that holds mingw-w64 alone 2026-10-31 20:48:06 +01:00
Crafter.Build-External.cpp fix: give the mingw target a sysroot that holds mingw-w64 alone 2026-10-31 20:48:06 +01:00
Crafter.Build-Implementation.cpp fix: decide a build step by its exit code, not by whether it printed 2026-08-26 00:51:15 +00:00
Crafter.Build-Interface.cpp fix: decide a build step by its exit code, not by whether it printed 2026-08-26 00:51:15 +00:00
Crafter.Build-Lint.cpp feat(toolchain): resolve the compiler in one place 2026-10-02 22:26:31 +02:00
Crafter.Build-Platform.cpp fix: give the mingw target a sysroot that holds mingw-w64 alone 2026-10-31 20:48:06 +01:00
Crafter.Build-Progress.cpp refactor: drop Windows host support 2026-10-02 22:03:34 +02:00
Crafter.Build-Script.cpp fix: rebuild and relink on what changed, submodules at their revisions, and mingw found where it is 2026-10-20 20:20:29 +02:00
Crafter.Build-Shader.cpp fix: rebuild and relink on what changed, submodules at their revisions, and mingw found where it is 2026-10-20 20:20:29 +02:00
Crafter.Build-Test.cpp feat(script): scripts in project.cpp, run with crafter-build run 2026-10-20 19:08:26 +02:00
Crafter.Build-Toolchain.cpp fix: give the mingw target a sysroot that holds mingw-w64 alone 2026-10-31 20:48:06 +01:00
main.cpp refactor: drop Windows host support 2026-10-02 22:03:34 +02:00