release: v0.0.17 — macOS self-host via xlings#49
Merged
Conversation
- 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)
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.
Summary
xlings install mcpp@0.0.16→mcpp build-lc++on macOS (Clang + xlings LLVM)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
#if defined(__APPLE__))