From 78c0733e3608fcf41b80b2d6bddbaa170a74b80c Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Mon, 24 Aug 2026 19:03:22 +0800 Subject: [PATCH 1/2] feat: declare the compiler-runtime layer and the compiler family it needs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这个包编译 729 个对象,其中 **498 个是 compiler-rt 的 builtins**、21 个是 libunwind 的、159 个 libcxx、51 个 libcxxabi。也就是说它最大的一块此前声明在 `mcpp:c++-abi` 名下 —— 而 `__udivti3` 及其同类是一个**纯 C 程序**需要的东西, 与 C++ 无关。 把 builtins 算作 C++ 运行时的一部分,等价于断言 C 程序不需要整数除法。 该断言已经产生过一次实测缺陷:一个交叉到 macOS 的 C 程序被问「有没有 C++ 运行时」,答「没有」,链接行因而保留了编译器载荷自带的 libc++, 把一个 Linux 共享对象递给了 Mach-O 链接器。 provides = [..., "mcpp:compiler-runtime=compiler-rt"] ── requires ────────────────────────────────────────────── libc++ 的源码、尤其它的 std 模块源,由 clang 编译。递给 gcc 的实测结果: fatal error: __config: No such file or directory 该消息命名一个读者从未打开过的文件,以及一个 mcpp 从未作出的决定。 把需求写在包里,构建工具就能在编译任何东西之前拒绝这个组合, 并且能够指出族名,而不必把这条事实写进构建工具: requires = ["mcpp:compiler=llvm"] 实测(mcpp 2026.8.24.2): error: `openkal-llvm-runtime@0.1.1` requires the compiler to be `llvm`. compiler gcc (16.1.0, payload) required llvm (required by openkal-llvm-runtime@0.1.1) Select that compiler — yours outranks mcpp's own default: mcpp toolchain default llvm ── 兼容性 ──────────────────────────────────────────────── ⚠️ 实测:**旧引擎(mcpp 2026.8.24.1)读带 `requires` 的清单构建成功** —— TOML 侧忽略未知键。因此本次声明不要求使用者先升级。 `hosted-standard-library` 与 `mcpp:c++-abi=libc++` 两条拼写均保留。 engine: mcpp-community/mcpp#494 --- mcpp.toml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/mcpp.toml b/mcpp.toml index ecd3b34a..e0e7f20f 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -1,7 +1,7 @@ [package] namespace = "mcpplibs" name = "openkal-llvm-runtime" -version = "0.1.1" +version = "0.1.2" description = "LLVM's C++ runtime libraries — libc++, libc++abi and libunwind — configured for openkal-musl rather than for a host C library." license = "Apache-2.0" authors = ["mcpplibs"] @@ -18,7 +18,27 @@ repo = "https://github.com/mcpplibs/openkal-llvm-runtime" # The older spelling is kept beside the current one so that an engine # predating the layer vocabulary still recognises this package. Both name the # same layer; a newer engine reads the second and ignores the first. -provides = ["hosted-standard-library", "mcpp:c++-abi=libc++"] +provides = [ + "hosted-standard-library", + "mcpp:c++-abi=libc++", + # ⭐ AND THE COMPILER RUNTIME, WHICH IS THE LARGER HALF OF THIS PACKAGE. + # + # Measured: of the 729 objects this package builds, 498 are compiler-rt's + # builtins and 21 are libunwind's. Those are what a C PROGRAM needs — + # `__udivti3` and its relatives have nothing to do with C++ — and declaring + # them under the C++ layer said this package supplied something it does not + # and concealed something it does. + "mcpp:compiler-runtime=compiler-rt", +] + +# What this package needs of the layer it does not supply. +# +# libc++'s sources, and its `std` module source above all, are compiled by +# clang. Handing them to gcc fails inside libc++'s own headers, in a message +# naming a file the reader has never opened. Stating the requirement here lets +# the build tool refuse the combination before it compiles anything, and lets it +# name the family without this fact being written into the build tool. +requires = ["mcpp:compiler=llvm"] # Where this package's `std' module source is, and what it needs. # From 18ed0acd95d9b4c8ee14a8a50f43fd4164c6ac78 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Mon, 24 Aug 2026 19:17:56 +0800 Subject: [PATCH 2/2] feat: require an llvm-family compiler, and name the compiler-runtime layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⚠️ 实测:该层名在 2026.8.24.2 之前的每一个已发布构建工具上都让整份清单 加载失败 —— 不是「该层被忽略」,是这个包用不了: error: dependency 'openkal-llvm-runtime': mcpp.toml: error: `provides = ["mcpp:compiler-runtime=compiler-rt"]` names no capability mcpp knows. 那条拒绝本身已在 mcpp 2026.8.24.2 修掉(依赖的清单里出现未知层名改为警告并 忽略,根工程自己的仍然报错),但**修复不能追溯到已经发布出去的工具**。 本仓 CI 的 MCPP_VERSION 目前是 2026.8.19.4。 `requires = ["mcpp:compiler=llvm"]` 保留 —— 实测旧引擎忽略未知的 [package] 键, 因此这一半今天就能发。声明留在注释里,连同它的依据与解除条件。 engine: mcpp-community/mcpp#494 --- mcpp.toml | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/mcpp.toml b/mcpp.toml index e0e7f20f..be45f1ae 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -18,18 +18,28 @@ repo = "https://github.com/mcpplibs/openkal-llvm-runtime" # The older spelling is kept beside the current one so that an engine # predating the layer vocabulary still recognises this package. Both name the # same layer; a newer engine reads the second and ignores the first. -provides = [ - "hosted-standard-library", - "mcpp:c++-abi=libc++", - # ⭐ AND THE COMPILER RUNTIME, WHICH IS THE LARGER HALF OF THIS PACKAGE. - # - # Measured: of the 729 objects this package builds, 498 are compiler-rt's - # builtins and 21 are libunwind's. Those are what a C PROGRAM needs — - # `__udivti3` and its relatives have nothing to do with C++ — and declaring - # them under the C++ layer said this package supplied something it does not - # and concealed something it does. - "mcpp:compiler-runtime=compiler-rt", -] +provides = ["hosted-standard-library", "mcpp:c++-abi=libc++"] + +# ⚠️ THE COMPILER RUNTIME IS THE LARGER HALF OF THIS PACKAGE AND IS NOT YET +# DECLARED, BECAUSE DECLARING IT WOULD MAKE THIS MANIFEST UNREADABLE TO EVERY +# RELEASED BUILD TOOL. +# +# Measured: of the 729 objects built here, 498 are compiler-rt's builtins and 21 +# are libunwind's. Those are what a C PROGRAM needs — `__udivti3` and its +# relatives have nothing to do with C++ — so declaring them under the C++ layer +# says this package supplies something it does not and conceals something it +# does. +# +# The layer is named `mcpp:compiler-runtime` from mcpp 2026.8.24.2, and a build +# tool released before that reports: +# +# error: `provides = ["mcpp:compiler-runtime=compiler-rt"]` names no +# capability mcpp knows. +# +# ⚠️ That refusal is itself fixed in 2026.8.24.2 — an unknown layer name in a +# DEPENDENCY's manifest is now ignored with a warning rather than refused — but +# the fix cannot apply retroactively to tools already released. The declaration +# is therefore added once this package's floor moves to 2026.8.24.2. # What this package needs of the layer it does not supply. #