Skip to content

release: v0.0.17 — macOS self-host via xlings#49

Merged
Sunrisepeak merged 17 commits into
mainfrom
release/v0.0.17
May 17, 2026
Merged

release: v0.0.17 — macOS self-host via xlings#49
Sunrisepeak merged 17 commits into
mainfrom
release/v0.0.17

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

  • Version bump to 0.0.17
  • macOS self-host: xlings install mcpp@0.0.16mcpp build
  • Fix: explicitly link -lc++ on macOS (Clang + xlings LLVM)
  • CI + release workflows use xlings ecosystem (no xmake)

Key change

flags.cppm: adds -lc++ to link flags on macOS when using Clang.
This fixes the libc++ undefined symbol errors during self-host builds.

Test plan

  • ci-macos: xlings install mcpp → mcpp build (self-host)
  • ci (Linux): unaffected (all changes in #if defined(__APPLE__))

- Bump version to 0.0.17
- .xlings.json: mcpp 0.0.16 (macOS-capable bootstrap)
- flags.cppm: explicitly link libc++ on macOS for Clang toolchain
- ci-macos.yml: use `xlings install mcpp` + `mcpp build` (self-host)
- release.yml: macOS job uses xlings mcpp to self-host build
Root cause: passing --sysroot to macOS linker forces it to use SDK
.tbd stubs which lack libc++abi exports. Fix: only pass sysroot to
compiler (for headers), let clang++ driver handle linking natively.

CI now validates 3 steps:
1. xmake builds mcpp (bootstrap)
2. That mcpp builds itself (self-host)
3. The self-hosted mcpp builds itself again (stability proof)
build.ninja calls `mcpp dyndep` — the bootstrap binary must be
findable via PATH. Add `which mcpp` verification before build.
ninja cwd differs from shell cwd — relative paths break.
Use $PWD/build/... to get absolute path.
Two issues combine:
1. --sysroot → SDK tbd stubs miss libc++abi (fixed: don't pass to ld)
2. clang++.cfg -nostdinc++ → suppresses implicit -lc++ (fixed: add explicitly)

Both are needed for correct macOS linking.
xlings LLVM's libc++.dylib doesn't pull in libc++abi, causing
undefined exception/RTTI symbols. Solution: don't pass -L<llvm>/lib
to the linker on macOS — let clang++ link against system libc++
(/usr/lib/libc++.dylib) which correctly includes libc++abi.

Compile still uses LLVM 20 headers (ABI-compatible with system libc++).
v2 lives under target/ — save it to /tmp before clearing.
The Linux CI uses its own xim:mcpp bootstrap path — changing this
to 0.0.16 broke the cache key and caused sandbox incompatibility.
macOS CI uses xmake bootstrap, not .xlings.json.
On cache miss (new mcpp.toml version), the sandbox lacks the xlings
binary. MCPP_VENDORED_XLINGS tells mcpp where to find it.
Replace xmake bootstrap with `xlings install mcpp` → `mcpp build`,
matching the Linux CI pattern exactly:
- ci-macos: xlings install mcpp → mcpp build → self-host smoke
- release: xlings install mcpp → mcpp build → package

No xmake dependency. mcpp auto-installs LLVM toolchain via xlings.
When cache misses (e.g., .xlings.json changed), gtest needs fresh
download. Default CN mirror is unreachable from GitHub runners.
Set GLOBAL mirror before test step, same as E2E already does.
Stale cache had mcpp@0.0.13 which lacks `self config --mirror`.
Bump cache key suffix to force fresh install of mcpp@0.0.16.
The bootstrap mcpp (from xlings cache) may not support `self config
--mirror`. Use the freshly-built binary for test + mirror config.
macOS CI now runs the same validation as Linux:
- mcpp build (self-host)
- mcpp test (unit + integration)
- E2E suite (run_all.sh)
- Self-host smoke

Toolchain default set to llvm@20.1.7 for macOS E2E tests.
macOS doesn't have /proc/self/exe. Use _NSGetExecutablePath from
mach-o/dyld.h to resolve the binary's absolute path. This fixes:
- build.ninja mcpp= variable (needed for dyndep)
- MCPP_HOME auto-detection from binary location
- run_all.sh: skip tests that assume GCC/ELF/patchelf on macOS
- sed -i → sed -i.bak for macOS compat (05, 09, 22)
- target/x86_64-linux-*/ → target/*/ for platform-portable path (24, 25)

Skipped on macOS (need future Clang/Mach-O adaptation):
  03 (gcm BMI), 07/08 (ELF lib), 09 (gcm BMI), 20/21 (GCC P1689/dyndep),
  22 (GCC fingerprint), 26/27/29 (GCC toolchain), 30 (patchelf), 33 (GCC mangling)
@Sunrisepeak Sunrisepeak merged commit bf455d1 into main May 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant