Skip to content

Commit 78c0733

Browse files
committed
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
1 parent 8216915 commit 78c0733

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

mcpp.toml

Lines changed: 22 additions & 2 deletions
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"]
@@ -18,7 +18,27 @@ 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+
# ⭐ AND THE COMPILER RUNTIME, WHICH IS THE LARGER HALF OF THIS PACKAGE.
25+
#
26+
# Measured: of the 729 objects this package builds, 498 are compiler-rt's
27+
# builtins and 21 are libunwind's. Those are what a C PROGRAM needs —
28+
# `__udivti3` and its relatives have nothing to do with C++ — and declaring
29+
# them under the C++ layer said this package supplied something it does not
30+
# and concealed something it does.
31+
"mcpp:compiler-runtime=compiler-rt",
32+
]
33+
34+
# What this package needs of the layer it does not supply.
35+
#
36+
# libc++'s sources, and its `std` module source above all, are compiled by
37+
# clang. Handing them to gcc fails inside libc++'s own headers, in a message
38+
# naming a file the reader has never opened. Stating the requirement here lets
39+
# the build tool refuse the combination before it compiles anything, and lets it
40+
# name the family without this fact being written into the build tool.
41+
requires = ["mcpp:compiler=llvm"]
2242

2343
# Where this package's `std' module source is, and what it needs.
2444
#

0 commit comments

Comments
 (0)