fix: give the mingw target a sysroot that holds mingw-w64 alone #44

Merged
jorijnvdgraaf merged 12 commits from claude/issue-43 into master 2026-10-31 22:35:49 +00:00
Showing only changes of commit 27697d06aa - Show all commits

fix: recompile the units whose std module was rebuilt in place

A .cpp unit's depfile listed its source and headers, never the BMIs it
imports: clang's driver adds -module-file-deps to --precompile only. A
std module rebuilt in its directory, which happens whenever its source
changes under one compiler and one set of flags (a libc++ update, or
mingw-w64's under the same prefix), left every object that imports it
as it was, and the next build only relinked them. Implementation units
are now compiled with -fmodule-file-deps, so the std PCM and the
project's own PCMs are prerequisites of their objects like headers.

Depfiles written before this lack the edge, so a std module that moves
directories still needs VariantId to move with it (StdPcmKey).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jorijn van der Graaf 2026-10-31 22:59:05 +01:00
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB

View file

@ -51,8 +51,13 @@ namespace Crafter {
return; return;
} }
// -MD leaves <name>_impl.o.d beside the object for Check to read. // -MD leaves <name>_impl.o.d beside the object for Check to read, and
std::string result = RunBuildCommand(std::format("{0} {1}.cpp -c -MD -MF {2}_impl.o.d -o {2}_impl.o", clang, path.string(), (buildDir/path.filename()).string())); // -fmodule-file-deps puts the BMIs the unit imported in it with the
// headers. The driver adds that for --precompile only, so a std
// module rebuilt in place, for a mingw-w64 or libc++ update under
// the same compiler, left the objects importing it as they were, and
// the next build only relinked them.
std::string result = RunBuildCommand(std::format("{0} {1}.cpp -c -MD -MF {2}_impl.o.d -fmodule-file-deps -o {2}_impl.o", clang, path.string(), (buildDir/path.filename()).string()));
bool expected = false; bool expected = false;
if(!result.empty() && buildCancelled.compare_exchange_strong(expected, true)) { if(!result.empty() && buildCancelled.compare_exchange_strong(expected, true)) {