Skip to content

Commit 28c4e11

Browse files
authored
declare the compiler runtime, which was always the larger half of this package (#4)
* declare the compiler runtime, which was always the larger half of this package 本包 729 个对象里,**498 个是 compiler-rt 的 builtins、21 个是 libunwind 的**。 那些是一个 **C 程序**需要的东西 —— `__udivti3` 和它的亲戚与 C++ 无关 —— 而清单此前只声明 `mcpp:c++-abi=libc++`,于是它说自己供给了不供给的东西, 同时隐瞒了真正供给的那一半。 provides = [ "hosted-standard-library", "mcpp:c++-abi=libc++", "mcpp:compiler-runtime=compiler-rt", ← 新增 ] 实测(本机,mcpp 2026.8.24.3): compiler llvm (22.1.8, payload) compiler-runtime compiler-rt (openkal-llvm-runtime@0.1.2, graph) ← 原为 payload kernel-abi openkal (openkal-linux@0.5.3, graph) c-abi musl (openkal-musl@0.3.3, graph) c++-abi libc++ (openkal-llvm-runtime@0.1.2, graph) 五层里四层来自图,只剩编译器本身来自载荷。 ── ⚠️ 同一改动里必须上移 MCPP_VERSION,原因不是兼容性 ──────── 一个键有三种结局,而其中两种都是 exit 0: provides = ["mcpp:compiler-runtime=…"] 2026.8.19.4 exit 0 **没有被校验** 2026.8.24.1 exit 2 拒绝 2026.8.24.3 exit 0 解析成功 ⭐ 19.4 那个零和 24.3 那个零**不是同一种成功**。前者早于层词表, 整个数组被当作不认识的键忽略 —— 它既不拒绝这条声明,也不读它。 CI 停在那里会在一份**中心主张从未被检查过**的清单上报绿。 因此 `MCPP_VERSION` 2026.8.19.4 → 2026.8.24.3 与本行同时改。 拒绝窗口只有 2026.8.24.1 一个版本(开始校验 `mcpp:` 前缀之后、 学会这一层之前)。索引已于今日到达 2026.8.24.3,且这些包尚无存量用户。 * ci: drop the branch-built tool, and make the bare-metal step reach bare metal 删掉的那个步骤自己写着退出条件:「⇒ When #486 ships, delete this step and raise MCPP_VERSION」。#486 已于 2026-08-23 合入并随 2026.8.24.1 起发布, 而这个步骤还在从 `feat/import-std-capability` 分支构建 mcpp 并盖掉刚装好的那个。 后果不是「多跑一次构建」。日志里两行并排: Install mcpp mcpp 2026.8.24.3 The build tool, from the branch… mcpp 2026.8.21.3 ← 实际跑的是它 于是 `MCPP_VERSION` 这个变量对**被测的行为**不起作用,本 PR 把它移到 24.3 之后 CI 仍然用 21.3 跑,报出三层版的错误信息。两个 job 各一处,一并删除。 ── ⚠️ 并且那一步在测宿主,而它的名字说的是裸机 ────────────── `The same source on bare metal, with exceptions` 跑的是裸的 `mcpp run`。 这个清单**刻意没有 `[build] target`**(注释就写在第 5 行),所以裸的 `mcpp run` 构建的是**宿主**。四行断言两种跑法都会打印 —— 那是清单自己的 主张,不是巧合 —— 于是这一步在宿主构建上报绿,**一次都没有到过 OpenSBI**。 实测 2026-08-24:产物是 `target/x86_64-linux-gnu/…`。 改法两处: · `mcpp run --target riscv64-none-elf` · 加一条 `grep -q 'Boot HART'`,即固件自己的横幅 —— 这样一次没离开宿主 的运行**无法**靠打印那四行应用输出来满足本步骤 本机实测改后:OpenSBI 横幅出现,四行输出与宿主一致。 * ci: pin 2026.8.24.4, which is the release that survives the bare-metal step 把 pin 移到 24.3 让裸机那一步第一次真正到达 OpenSBI,而**它之后的那一步** 随即失败:`mcpp run --target X` 一直把 X 的构建记在宿主的缓存槽里, 于是下一条裸的 `mcpp run` 直接 exec 了交叉产物。 那个缺陷早于本包,只因为一个自称测裸机的步骤开始真的测裸机才现形。 mcpp-community/mcpp#498 修复,随 2026.8.24.4 发布。 * ci: the emulated serial console ends lines with CRLF 裸机那一步的四行与宿主的四行**内容完全一致**,而 `diff` 报四行全不同: 1,4c1,4 < sorted: 2 4 7 --- > sorted: 2 4 7 不可见字符。裸机运行经由模拟的 16550 UART 到达控制台,而串口控制台 以 CRLF 结束一行;宿主运行不是。 ⭐ 这种失败读起来像是**被测的主张不成立**,而不像承载它的传输层不同 —— 两侧各加一个 `tr -d '\r'`。断言的是程序打印了什么,不是字节怎么到达的。 同样是把那一步从裸的 `mcpp run`(宿主)改成真的 `--target riscv64-none-elf` 之后才暴露的。
1 parent dfdcadc commit 28c4e11

2 files changed

Lines changed: 63 additions & 110 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
workflow_dispatch:
1818

1919
env:
20-
MCPP_VERSION: 2026.8.19.4
20+
MCPP_VERSION: 2026.8.24.4
2121
XLINGS_VERSION: v2026.8.17.2
2222
XLINGS_NON_INTERACTIVE: '1'
2323

@@ -107,61 +107,6 @@ jobs:
107107
xlings install xim:qemu-riscv -y
108108
XLINGS_HOME="$HOME/.mcpp/registry" xlings install xim:qemu-riscv -y
109109
110-
# ⚠️ THE BUILD TOOL IS BUILT FROM A BRANCH, AND THAT IS TEMPORARY.
111-
#
112-
# This step needs four decisions that no released mcpp makes yet, each of
113-
# which belongs to the tool rather than to this package:
114-
#
115-
# `import std` is gated on whether a package PROVIDES a standard
116-
# library for the target rather than on whether the target is
117-
# freestanding; a package may carry its own std module source;
118-
# `-fno-exceptions` / `-fno-rtti` / `-ffreestanding` come off when the
119-
# graph supplies a C++ runtime built for the target; and unwind tables
120-
# go on, because the compiler turns them off for this kind of target
121-
# and a partial set of tables stops the walk rather than degrading it.
122-
#
123-
# They are on mcpp-community/mcpp#486. Until that is released this job
124-
# builds the tool the same way every other dependency here is taken —
125-
# from the branch — so the criterion below is actually enforced instead
126-
# of being a comment saying it was verified once on a laptop.
127-
#
128-
# ⇒ When #486 ships, delete this step and raise MCPP_VERSION.
129-
- name: The build tool, from the branch that has what this needs
130-
if: matrix.toolchain == 'llvm@22.1.8'
131-
run: |
132-
set -euo pipefail
133-
git clone --depth 1 -b feat/import-std-capability \
134-
https://github.com/mcpp-community/mcpp "$RUNNER_TEMP/mcpp-src"
135-
cd "$RUNNER_TEMP/mcpp-src"
136-
# ⚠️ THE CLONE CARRIES A WORKSPACE PIN, AND IT NAMES A VERSION THE
137-
# INDEX NO LONGER HAS.
138-
#
139-
# xlings: version '2026.8.17.1' not found for 'mcpp'
140-
# available: 2026.8.19.4
141-
#
142-
# `.xlings.json` at a repository root says which mcpp a build in that
143-
# tree uses, and mcpp's own bootstrap pin does not move when mcpp is
144-
# released — it is the version that was current when the pin was last
145-
# touched. Cloning the branch therefore imports a pin that is only
146-
# valid inside that repository's own CI, where the same file selects
147-
# what gets installed.
148-
#
149-
# Rewriting it to the version this job already installed is what makes
150-
# the two agree. It changes nothing about what is being tested: the
151-
# pin selects the tool that BUILDS mcpp, and what is under test is the
152-
# mcpp that comes out.
153-
printf '{\n "workspace": {\n "mcpp": "%s"\n }\n}\n' "$MCPP_VERSION" > .xlings.json
154-
# ⚠️ `--dev` AND NOT `--release`. What is under test is a set of
155-
# decisions the tool makes about compile flags; an optimisation level
156-
# changes none of them. Measured: the release self-build took over
157-
# half an hour of a sixty-minute job on a two-core runner, which is
158-
# most of the budget spent on something the test does not observe.
159-
mcpp build --dev
160-
BUILT=$(find target -type f -name mcpp -perm -u+x | head -1)
161-
[ -n "$BUILT" ] || { echo "::error::mcpp did not build"; exit 1; }
162-
echo "$(cd "$(dirname "$BUILT")" && pwd)" >> "$GITHUB_PATH"
163-
"$BUILT" --version
164-
165110
- name: The same source on bare metal, with exceptions
166111
if: matrix.toolchain == 'llvm@22.1.8'
167112
run: |
@@ -175,7 +120,18 @@ jobs:
175120
grep -q '"qemu-system-riscv64"' mcpp.toml \
176121
|| { echo "::error::the manifest no longer carries the bare emulator name"; exit 1; }
177122
sed -i "s|\"qemu-system-riscv64\"|\"$Q\"|" mcpp.toml
178-
mcpp run 2>&1 | tee out.log
123+
# ⚠️ `--target riscv64-none-elf`, AND THE FLAG IS THE WHOLE STEP.
124+
#
125+
# This manifest carries no `[build] target`, so a bare `mcpp run`
126+
# builds for the HOST and passes — the four lines below appear either
127+
# way, which is the manifest's own claim and not an accident. A step
128+
# named "on bare metal" that omits the flag therefore reports green
129+
# over a host build and has never once reached OpenSBI. Measured
130+
# 2026-08-24: the artefact was `target/x86_64-linux-gnu/…`.
131+
mcpp run --target riscv64-none-elf 2>&1 | tee out.log
132+
# The emulator's own banner, so a run that never left the host cannot
133+
# satisfy this step by printing the four application lines.
134+
grep -q 'Boot HART' out.log # firmware ran; this is OpenSBI
179135
grep -q 'sorted: 2 4 7' out.log # containers + algorithms + the allocator
180136
grep -q 'caught: 42' out.log # the unwinder found the handler
181137
grep -q 'unwound: true' out.log # ⭐ and ran a destructor on the way
@@ -195,8 +151,16 @@ jobs:
195151
cd examples/same-source && mcpp run 2>&1 | tee host.log
196152
grep -q 'import std over openkal: ok' host.log
197153
# The four lines are the same four lines.
198-
diff <(grep -E '^(sorted|caught|unwound|import std over openkal):' out.log) \
199-
<(grep -E '^(sorted|caught|unwound|import std over openkal):' host.log)
154+
#
155+
# ⚠️ `tr -d '\r'` ON BOTH SIDES, AND IT IS NOT COSMETIC. The bare-metal
156+
# run reaches the console through an emulated 16550 UART, and a serial
157+
# console terminates lines with CRLF; the native run does not. Without
158+
# this the diff reports four differing lines whose visible text is
159+
# identical, which reads as a failure of the claim being tested rather
160+
# than of the transport carrying it. The assertion is about what the
161+
# program printed, not about how the bytes arrived.
162+
diff <(grep -E '^(sorted|caught|unwound|import std over openkal):' out.log | tr -d '\r') \
163+
<(grep -E '^(sorted|caught|unwound|import std over openkal):' host.log | tr -d '\r')
200164
201165
# ⭐⭐ AND THE SAME SOURCE FOR TWO MACHINES THIS ONE IS NOT.
202166
#
@@ -398,25 +362,6 @@ jobs:
398362
mcpp toolchain install llvm 22.1.8
399363
mcpp toolchain default 'llvm@22.1.8'
400364
401-
# ⚠️ Same temporary step as the Linux job: the decisions this exercises are
402-
# on mcpp#486 and not in any release. When that ships, this goes and
403-
# MCPP_VERSION rises. See the long note in the `runtime` job.
404-
- name: The build tool, from the branch that has what this needs
405-
run: |
406-
set -euo pipefail
407-
git clone --depth 1 -b feat/import-std-capability \
408-
https://github.com/mcpp-community/mcpp "$RUNNER_TEMP/mcpp-src"
409-
cd "$RUNNER_TEMP/mcpp-src"
410-
printf '{\n "workspace": {\n "mcpp": "%s"\n }\n}\n' "$MCPP_VERSION" > .xlings.json
411-
mcpp build --dev
412-
# ⚠️ Named exactly, and `-perm` is not used. On Windows every file
413-
# reads as executable, so a permission test selects nothing useful;
414-
# `mcpp.exe` is the name there and `mcpp` everywhere else.
415-
BUILT=$(find target -type f \( -name 'mcpp' -o -name 'mcpp.exe' \) | head -1)
416-
[ -n "$BUILT" ] || { echo "::error::mcpp did not build"; exit 1; }
417-
echo "$(cd "$(dirname "$BUILT")" && pwd)" >> "$GITHUB_PATH"
418-
"$BUILT" --version
419-
420365
- name: Every target, from this host
421366
run: |
422367
set -euo pipefail

mcpp.toml

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,47 @@ repo = "https://github.com/mcpplibs/openkal-llvm-runtime"
1818
# The older spelling is kept beside the current one so that an engine
1919
# predating the layer vocabulary still recognises this package. Both name the
2020
# same layer; a newer engine reads the second and ignores the first.
21-
provides = ["hosted-standard-library", "mcpp:c++-abi=libc++"]
21+
provides = [
22+
"hosted-standard-library",
23+
"mcpp:c++-abi=libc++",
24+
# ⚠️ THE LARGER HALF OF THIS PACKAGE, AND IT IS NOT A C++ THING.
25+
#
26+
# Of the 729 objects built here, 498 are compiler-rt's builtins and 21 are
27+
# libunwind's. Those are what a C PROGRAM needs — `__udivti3` and its
28+
# relatives have nothing to do with C++ — so declaring them under the C++
29+
# layer would say this package supplies something it does not and conceal
30+
# something it does.
31+
"mcpp:compiler-runtime=compiler-rt",
32+
]
2233

23-
# ⚠️ THE COMPILER RUNTIME IS THE LARGER HALF OF THIS PACKAGE AND IS NOT YET
24-
# DECLARED, BECAUSE DECLARING IT WOULD MAKE THIS MANIFEST UNREADABLE TO EVERY
25-
# RELEASED BUILD TOOL.
26-
#
27-
# Measured: of the 729 objects built here, 498 are compiler-rt's builtins and 21
28-
# are libunwind's. Those are what a C PROGRAM needs — `__udivti3` and its
29-
# relatives have nothing to do with C++ — so declaring them under the C++ layer
30-
# says this package supplies something it does not and conceals something it
31-
# does.
32-
#
33-
# The layer is named `mcpp:compiler-runtime` from mcpp 2026.8.24.2, and a build
34-
# tool released before that reports:
35-
#
36-
# error: `provides = ["mcpp:compiler-runtime=compiler-rt"]` names no
37-
# capability mcpp knows.
38-
#
39-
# ⚠️ That refusal is itself fixed in 2026.8.24.2 — an unknown layer name in a
40-
# DEPENDENCY's manifest is now ignored with a warning rather than refused — but
41-
# the fix cannot apply retroactively to tools already released.
42-
#
43-
# ⚠️ AND THE CRITERION IS NOT THIS PACKAGE'S FLOOR. It is what the index serves,
44-
# because that is what a reader of this file actually has. Measured 2026-08-24
45-
# against the two keys, with a dependency declaring each and a build tool taken
46-
# from the version the index named `latest`:
47-
#
48-
# requires = ["mcpp:compiler=llvm"] 2026.8.24.1 exit 0, ignored
49-
# provides = ["mcpp:compiler-runtime=…"] 2026.8.24.1 exit 2, refused
50-
#
51-
# So `requires` is safe to publish today and the layer declaration is not. The
52-
# gate on adding it is that the index's `latest` be at 2026.8.24.2 or above —
53-
# not that a newer mcpp exists, and not that this package's floor was raised.
34+
# ── The floor this declaration puts under the package ───────────────────────
35+
#
36+
# `mcpp:compiler-runtime` is a layer name mcpp learned in 2026.8.24.2. Measured
37+
# 2026-08-24, one dependency declaring one key, each build tool taken from a
38+
# published release:
39+
#
40+
# requires = ["mcpp:compiler=llvm"] 2026.8.19.4 exit 0 not validated
41+
# 2026.8.24.1 exit 0 not validated
42+
# provides = ["mcpp:compiler-runtime=…"] 2026.8.19.4 exit 0 not validated
43+
# 2026.8.24.1 exit 2 REFUSED
44+
# 2026.8.24.3 exit 0 resolved
45+
#
46+
# ⚠️ THE TWO ZEROES AT 2026.8.19.4 ARE NOT THE SAME KIND OF SUCCESS AS THE ONE
47+
# AT 2026.8.24.3. That tool predates the layer vocabulary and ignores the whole
48+
# array, so it neither refuses the declaration nor reads it. A CI pinned there
49+
# would report green over a manifest whose central claim was never examined,
50+
# which is why this package's `MCPP_VERSION` moves in the same change that adds
51+
# the line. It moves to 2026.8.24.4 rather than .3: raising the pin made the
52+
# bare-metal step below reach OpenSBI for the first time, and the step AFTER it
53+
# then failed — `mcpp run --target X` had been recording X's build under the
54+
# host's cache key, so the next bare `mcpp run` exec'd the cross artefact. The
55+
# defect predates this package and was found only because a step that claimed to
56+
# test bare metal started doing so. Fixed in mcpp-community/mcpp#498.
57+
#
58+
# The window that REFUSES is 2026.8.24.1 alone — between the release that began
59+
# validating the `mcpp:` prefix and the one that learned this layer. Publishing
60+
# into it was deferred until the index served a tool past it; the index reached
61+
# 2026.8.24.3 on 2026-08-24 and these packages have no installed base behind it.
5462

5563
# What this package needs of the layer it does not supply.
5664
#

0 commit comments

Comments
 (0)