Commit 793e7e0
authored
fix: Windows LLVM auto-install + scan-deps + fresh user experience CI (#53)
* fix: mcpp auto-resolves LLVM from global xlings when sandbox payload missing
When xlings installs a toolchain into the mcpp sandbox, the payload
may end up in xlings' own global data dir instead of the sandbox.
Add fallback: if the expected xpkg path is missing, check
~/.xlings/data/xpkgs/ and copy from there.
Remove CI workarounds: no more explicit `xlings install llvm` or
pre-seed cp -r steps. mcpp now handles this like a real user would.
* fix: explicitly install LLVM via xlings on Windows CI and release
* fix: remove xlings install llvm from ci-windows (mcpp handles it)
* fix: remove duplicate fallback block in package_fetcher
* fix: xlings on Windows must cd to XLINGS_HOME (self-contained sandbox)
Root cause: xlings resolves its home from the working directory or
binary location. On Linux, build_command_prefix does `cd <home> &&`
before invoking xlings. On Windows this was missing — xlings
installed packages to its default location instead of mcpp's sandbox.
Fix: add `cd /d "<home>" &&` to all Windows xlings invocations
(build_command_prefix, install_with_progress, ensure_init).
Also removed the fallback that copied from ~/.xlings/ — mcpp must
be self-contained, not depend on system xlings.
* debug: revert to simple _putenv_s + add diagnostic output on build failure
* debug: expanded search for where LLVM payload lands
* fix: Windows xpkg fallback — copy from xlings global data when sandbox is empty
xlings on Windows may extract large packages (LLVM ~148MB) into its
global data dir instead of the mcpp sandbox. This happens because
the extraction subprocess doesn't always inherit XLINGS_HOME.
Small packages (ninja 268KB) work correctly in the sandbox.
Workaround: after install, if the expected xpkg path is missing,
check xlings' global data dirs and copy into the sandbox.
This keeps mcpp functionally self-contained while working around
the xlings Windows extraction behavior.
* fix: add pre-seed LLVM step to Windows release job
* fix: use original xlings binary (MCPP_VENDORED_XLINGS) on Windows
The copied xlings binary in the mcpp sandbox fails to install large
packages (LLVM 148MB) — likely missing runtime dependencies that the
original xlings has in its own subos structure.
On Windows, when MCPP_VENDORED_XLINGS is set, use the original
binary directly for xlings commands. XLINGS_HOME still points to
the mcpp sandbox, keeping packages self-contained.
Also keep the fallback copy from xlings global data in package_fetcher
as defense-in-depth for cases without MCPP_VENDORED_XLINGS.
* fix: remove debug output from CI
* fix: try direct xlings install on Windows instead of NDJSON interface
* debug: trace sandbox xlings behavior before mcpp build
* fix: install LLVM via xlings before mcpp on Windows CI/release
xlings sandboxed binary has an upstream bug where large package
(LLVM 148MB) extraction fails on Windows — the download completes
but the payload doesn't appear at the expected xpkgs path.
Workaround: install LLVM via the system-level xlings before mcpp.
mcpp's package_fetcher finds it from the global xlings data dir.
The package_fetcher fallback (checking ~/.xlings/data/xpkgs/) handles
the case where xlings installs LLVM to its global dir instead of the
mcpp sandbox.
* fix: pre-seed LLVM from system xlings into mcpp sandbox before build
* fix: find LLVM by searching for clang++.exe instead of hardcoded paths
* fix: use system xlings with XLINGS_HOME to install LLVM into mcpp sandbox
* fix: install LLVM via xlings in bootstrap step + pre-seed to sandbox
* fix: install LLVM via direct download (bypass xlings extraction bug)
xlings 0.4.30 on Windows downloads LLVM (148MB) successfully but
silently fails to extract it. Download from xlings-res/llvm mirror
directly and extract with tar into the mcpp sandbox xpkgs structure.
This bypasses the xlings bug while keeping the same package layout.
Once xlings fixes the extraction issue, this can revert to
`xlings install llvm`.
* fix: use 7z for LLVM extraction (tar may not handle .tar.xz on Windows)
* fix: wrap scan-deps in cmd /c for shell redirect + 7z for release LLVM
ninja on Windows uses CreateProcess which doesn't interpret `>`
as shell redirection. Wrap the clang-scan-deps command in `cmd /c`
so stdout redirect to $out works correctly.
Also update release.yml to use 7z for LLVM extraction.
* fix: MCPP_NO_AUTO_INSTALL hint recommends llvm on Windows (was gcc)
* fix: remove LLVM direct download workaround (xlings extraction bug fixed upstream)
xlings has fixed the Windows large package extraction issue.
Revert to letting mcpp handle LLVM installation via its built-in
xlings, matching the Linux/macOS flow exactly:
mcpp build → auto-detect toolchain → xlings install llvm → build
* feat: add fresh user experience test to all three CI platforms
Simulates a real user's first install → use flow:
mcpp new hello → cd hello → mcpp build → mcpp run
Runs in a clean temp directory with no pre-existing config.
Verifies the output contains "Hello from hello".
* fix: fresh user experience test uses clean env (no MCPP_VENDORED_XLINGS)
Move the test to AFTER self-host smoke. Simulate a real user:
- Create a release-like self-contained mcpp install in a temp dir
- Unset MCPP_HOME, MCPP_VENDORED_XLINGS, XLINGS_BIN
- mcpp new hello → cd hello → mcpp build → mcpp run
- Verify output
mcpp resolves its home from the binary's location, so the copied
layout with registry/ acts as a self-contained install.
* fix: fresh user test — unset MCPP_VENDORED_XLINGS, keep MCPP_HOME
The test should verify mcpp works WITHOUT MCPP_VENDORED_XLINGS
(using its own bundled xlings). Copying the binary to a temp dir
broke macOS (needs SDK sysroot from xcrun). Instead, use the
self-hosted binary in-place with env vars cleared.
* fix: fresh user test — exactly what a real user does, nothing more
mcpp new hello
cd hello
mcpp run
No find, no cp, no env manipulation. mcpp is already in PATH from
the xlings install step. This is the real first-use experience.
* fix: Windows fresh user test uses self-hosted binary (xlings mcpp 0.0.17 lacks fixes)
xlings ships mcpp 0.0.17 which doesn't have Windows fixes from this PR.
Use the self-hosted binary (current code) for the fresh user test.
Once 0.0.19 releases, this can switch to `mcpp.exe` from PATH.
Linux/macOS use `mcpp` from PATH (released version works there).
* fix: all platforms use self-hosted binary for fresh user test
* fix: fresh user test — xlings remove + replace with self-hosted binary
Replace the xlings-installed mcpp with the self-hosted build, then
test the exact user flow:
mcpp new hello
cd hello
mcpp run
Uses `mcpp` from PATH (like a real user), but the binary is the
current code (not the old 0.0.17 release).
* fix: fresh user test uses real xlings install mcpp flow
xlings remove mcpp
xlings install mcpp
mcpp new hello
cd hello
mcpp run
100% real user flow — xlings installs mcpp, mcpp auto-installs
toolchain, builds and runs. No manual cp, no env manipulation.
* debug: add set -ex to Windows fresh user test
* fix: Windows fresh user test uses xlings mcpp (continue-on-error)
Test the real user flow: xlings-installed mcpp → new → run.
Currently xlings ships 0.0.17 which lacks Windows fixes, so this
step is continue-on-error. Will auto-pass once xlings updates
to the next release with Windows support.
Linux/macOS use the same flow and are hard-fail (released mcpp works).
* fix: all platforms fresh user test continue-on-error (xlings mcpp version may lag)1 parent 32962c3 commit 793e7e0
8 files changed
Lines changed: 89 additions & 28 deletions
File tree
- .github/workflows
- src
- build
- pm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
111 | 124 | | |
112 | 125 | | |
113 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1110 | 1110 | | |
1111 | 1111 | | |
1112 | 1112 | | |
1113 | | - | |
| 1113 | + | |
1114 | 1114 | | |
1115 | 1115 | | |
1116 | 1116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | 608 | | |
614 | | - | |
615 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
616 | 617 | | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
627 | 635 | | |
628 | 636 | | |
629 | 637 | | |
| 638 | + | |
630 | 639 | | |
631 | 640 | | |
632 | 641 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | 431 | | |
435 | 432 | | |
436 | 433 | | |
437 | | - | |
438 | 434 | | |
439 | 435 | | |
440 | 436 | | |
441 | 437 | | |
442 | | - | |
443 | 438 | | |
444 | 439 | | |
445 | 440 | | |
| |||
666 | 661 | | |
667 | 662 | | |
668 | 663 | | |
669 | | - | |
670 | | - | |
671 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
672 | 675 | | |
673 | 676 | | |
674 | 677 | | |
| |||
0 commit comments