feat(toolchain): Linux→Windows MinGW cross toolchain (mingw-cross) — host≠target (0.0.92)#216
Merged
Merged
Conversation
…host≠target (0.0.92)
Cross-compile Windows x86_64 PE (incl. import std) from a Linux host — the
deferred host≠target axis registered in the 0.0.89 msvc-mingw design (§4.4/§7).
- registry: mingw-cross → xim mingw-cross-gcc (x86_64-w64-mingw32-g++ frontend,
triple-prefixed archiver, Linux-host index visibility)
- lifecycle: lift the Windows-host gate for the cross package (native mingw stays
Windows-only); skip glibc/linux-headers sysroot deps (PE own CRT)
- prepare: --target x86_64-w64-mingw32 convention → mingw-cross@16.1.0, static
- host≠target fixes surfaced by real end-to-end validation:
* gcc.cppm: find std module source under <prefix>/<triple>/include/c++/
* gcc.cppm + flags.cppm: self-contained toolchains (musl+mingw) skip external -B
(Linux as can't assemble MinGW PE/SEH output)
* flags.cppm: MinGW PE link (-static / -lstdc++exp) keyed on is_mingw_target
(target) instead of is_windows (host) — was unreachable on a Linux cross
- toolchain: from-source GCC 16.1.0 mingw-w64 MSVCRT cross, published at
xlings-res/mingw-cross-gcc + xim-pkgindex (import std verified under wine)
- tests: unit MapsMingwCrossSpecToCrossPackage; e2e 102_mingw_cross_wine.sh;
run_all mingw-cross/wine caps; CI cross-build-test mingw-cross-wine job
- design: .agents/docs/2026-07-15-mingw-linux-cross-windows-design.md
Verified end-to-end via the published ecosystem: mcpp toolchain install
mingw-cross → mcpp build --target x86_64-w64-mingw32 → PE32+ (KERNEL32+msvcrt
only) → wine runs import std + multi-module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linux → Windows MinGW-w64 交叉工具链(
mingw-cross)在 Linux 主机上交叉编译出 Windows x86_64 PE(含
import std)。补 0.0.89msvc-mingw-design§4.4/§7 登记的延期项——工具链抽象的最后一维 host≠target。改动
mingw-cross→ ximmingw-cross-gcc(前端x86_64-w64-mingw32-g++、triple 前缀 archiver、Linux 主机 index 可见)mingw仍 Windows-only);跳过 glibc/linux-headers(PE 自带 CRT)--target x86_64-w64-mingw32约定 →mingw-cross@16.1.0,默认 staticgcc.cppm: std 模块源探测补<prefix>/<triple>/include/c++/子目录gcc.cppm+flags.cppm: 自包含工具链(musl+mingw)跳过外部-B(Linuxas编不了 MinGW 的 PE/SEH asm)flags.cppm: MinGW PE link(-static/-lstdc++exp)由is_windowshost 门改为is_mingw_targettarget 判定(此前 Linux 交叉永不进该分支)工具链 + 生态(已发布)
x86_64-pc-windows-gnu)xlings-res/mingw-cross-gcc(GitHub+GitCode)+xim-pkgindex(PR #389 已合)验证(全链实测闭环)
mcpp toolchain install mingw-cross 16.1.0→mcpp build --target x86_64-w64-mingw32→crosswin.exe(PE32+,仅 KERNEL32+msvcrt)→ wine 跑 import std + 多模块。单测 33/33;e2e102_mingw_cross_wine.sh过;CIcross-build-test加mingw-cross-winejob。设计:
.agents/docs/2026-07-15-mingw-linux-cross-windows-design.md(§11 实测结果 + 4 个 host≠target bug 复盘)。