Skip to content

feat: require an llvm-family compiler, and name the compiler-runtime layer - #2

Merged
Sunrisepeak merged 2 commits into
mainfrom
feat/declare-compiler-runtime
Aug 24, 2026
Merged

feat: require an llvm-family compiler, and name the compiler-runtime layer#2
Sunrisepeak merged 2 commits into
mainfrom
feat/declare-compiler-runtime

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

Summary

这个包编译 729 个对象,其中 498 个是 compiler-rt 的 builtins、21 个 libunwind、159 个 libcxx、51 个 libcxxabi。也就是说它最大的一块此前声明在 mcpp:c++-abi 名下 —— 而 __udivti3 及其同类是一个纯 C 程序需要的东西。

  • provides 增加 mcpp:compiler-runtime=compiler-rt
  • 新增 requires = ["mcpp:compiler=llvm"]

为什么 requires

libc++ 的源码、尤其它的 std 模块源由 clang 编译。递给 gcc 的实测结果是

fatal error: __config: No such file or directory

—— 一个命名了读者从未打开过的文件、且不提任何 mcpp 决定的消息。声明之后:

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-librarymcpp:c++-abi=libc++ 两条拼写均保留。

Test plan

  • 本地 path 依赖:gcc 被拒绝并给出可粘贴修法;llvm 正常构建并运行,报告出现 compiler-runtime compiler-rt (…, graph)
  • CI

engine: mcpp-community/mcpp#494

…eeds

这个包编译 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
@Sunrisepeak
Sunrisepeak force-pushed the feat/declare-compiler-runtime branch from b3e0cdc to 5773e68 Compare August 24, 2026 11:18
@Sunrisepeak Sunrisepeak changed the title feat: 声明 compiler-runtime 层与对编译器族的需求 feat: require an llvm-family compiler, and name the compiler-runtime layer Aug 24, 2026
…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
@Sunrisepeak
Sunrisepeak force-pushed the feat/declare-compiler-runtime branch 2 times, most recently from 6f3cfee to 18ed0ac Compare August 24, 2026 11:48
@Sunrisepeak
Sunrisepeak merged commit 28034c3 into main Aug 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant