Skip to content

Commit 28034c3

Browse files
authored
feat: require an llvm-family compiler, and name the compiler-runtime layer (#2)
* feat: declare the compiler-runtime layer and the compiler family it needs 这个包编译 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 * feat: require an llvm-family compiler, and name the compiler-runtime layer ⚠️ 实测:该层名在 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
1 parent 8216915 commit 28034c3

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

mcpp.toml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
namespace = "mcpplibs"
33
name = "openkal-llvm-runtime"
4-
version = "0.1.1"
4+
version = "0.1.2"
55
description = "LLVM's C++ runtime libraries — libc++, libc++abi and libunwind — configured for openkal-musl rather than for a host C library."
66
license = "Apache-2.0"
77
authors = ["mcpplibs"]
@@ -20,6 +20,36 @@ repo = "https://github.com/mcpplibs/openkal-llvm-runtime"
2020
# same layer; a newer engine reads the second and ignores the first.
2121
provides = ["hosted-standard-library", "mcpp:c++-abi=libc++"]
2222

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. The declaration
42+
# is therefore added once this package's floor moves to 2026.8.24.2.
43+
44+
# What this package needs of the layer it does not supply.
45+
#
46+
# libc++'s sources, and its `std` module source above all, are compiled by
47+
# clang. Handing them to gcc fails inside libc++'s own headers, in a message
48+
# naming a file the reader has never opened. Stating the requirement here lets
49+
# the build tool refuse the combination before it compiles anything, and lets it
50+
# name the family without this fact being written into the build tool.
51+
requires = ["mcpp:compiler=llvm"]
52+
2353
# Where this package's `std' module source is, and what it needs.
2454
#
2555
# The build tool otherwise asks the compiler (`-print-library-module-manifest-path'),

0 commit comments

Comments
 (0)