Skip to content

Commit 53189b2

Browse files
committed
test: run B4 — two-stage self-host instead of ldflags injection
Run B3 post-mortem: the v2 injection never actually ran (a merge conflict broke the command chain), so B3 re-tested B2's injection. But injection is the wrong tool anyway — the bootstrap's hardcoded -lc++ precedes user ldflags. Two-stage self-host removes the problem: stage 1 (bootstrap-built, dynamic, runs on the build host) rebuilds itself as stage 2 with flags.cppm's native staticStdlib implementation.
1 parent 45daea9 commit 53189b2

1 file changed

Lines changed: 13 additions & 19 deletions

File tree

.github/workflows/temp-macos14-support.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,21 @@ jobs:
9595
test -f "$LLVM_ROOT/lib/libc++.a" || { echo "FAIL: libc++.a missing"; exit 1; }
9696
test -f "$LLVM_ROOT/lib/libc++abi.a" || { echo "FAIL: libc++abi.a missing"; exit 1; }
9797
98-
- name: "Inject static-libc++ ldflags into both manifests"
99-
run: |
100-
cat > /tmp/inject.py <<'PYEOF'
101-
import sys
102-
llvm = sys.argv[1]
103-
flags = 'ldflags = ["-nostdlib++", "%s/lib/libc++.a", "%s/lib/libc++abi.a"]' % (llvm, llvm)
104-
for path in sys.argv[2:]:
105-
text = open(path).read()
106-
assert "[build]" in text, path
107-
assert "ldflags" not in text, path
108-
text = text.replace("[build]", "[build]\n" + flags, 1)
109-
open(path, "w").write(text)
110-
print("injected into " + path)
111-
PYEOF
112-
python3 /tmp/inject.py "$LLVM_ROOT" mcpp.toml xlings-src/mcpp.toml
113-
grep -n "ldflags" mcpp.toml xlings-src/mcpp.toml
114-
115-
- name: Build mcpp@HEAD (target 11.0, static libc++)
98+
- name: "Build mcpp@HEAD (two-stage self-host: target 11.0, static libc++)"
11699
env:
117100
MACOSX_DEPLOYMENT_TARGET: '11.0'
118101
MCPP_HOME: /Users/runner/.mcpp
119102
run: |
120-
"$MCPP" build --no-cache
103+
# Stage 1: bootstrap (0.0.49) builds mcpp@HEAD. Its macOS link
104+
# path hardcodes -lc++, so stage 1 is dynamically linked — fine,
105+
# it only needs to RUN on this runner.
106+
"$MCPP" build
107+
STAGE1=$(find target -type f -path '*/bin/mcpp' | head -1)
108+
STAGE1="$PWD/$STAGE1"
109+
"$STAGE1" --version
110+
# Stage 2: mcpp@HEAD rebuilds itself — its flags.cppm implements
111+
# staticStdlib for the macOS link path natively.
112+
"$STAGE1" build --no-cache
121113
ART=$(find target -type f -path '*/bin/mcpp' | head -1)
122114
test -n "$ART"
123115
echo "ART=$ART" >> "$GITHUB_ENV"
@@ -130,6 +122,8 @@ jobs:
130122
if otool -L "$ART" | grep -q "libc++"; then
131123
echo "FAIL: still linked against system libc++"; exit 1
132124
fi
125+
echo "=== build.ninja ldflags (evidence) ==="
126+
grep -h "^ldflags" target/*/*/build.ninja | head -2 || true
133127
echo "=== smoke on macos-15 (checks static-dtor abort too) ==="
134128
"$ART" --version
135129
echo "exit: $?"

0 commit comments

Comments
 (0)