Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .agents/docs/2026-11-10-cross-platform-ecosystem-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ status: active
# 生态方案:跨平台通用基础设施(mcpp + openkal + xim),以一个 C89 工程为验证

**日期:** 2026-11-10
**状态:** 第四版,mcpp 部分已在 2026.11.10.1 实施。Q1–Q6 已定稿(第 11.1 节);O1–O4 已按推荐实施,实施中的调整见第 11.2 节;第 12 节为两项
**状态:** 第四版,mcpp 部分已在 2026.11.10.1 实施,K9、E15、I1 的补正与 #918 的修正在 2026.11.10.2。Q1–Q6 已定稿(第 11.1 节);O1–O4 已按推荐实施,实施中的调整见第 11.2 节;第 12 节为两项
风险的说明,第 13 节为多视角深度自审;第 15 节为实施记录,第 16 节为测试体系向 mtest 的迁移
**范围:** mcpp(引擎与内置数据);openkal 家族(openkal 规范、openkal-linux/macos/windows、openkal-musl、
openkal-llvm-runtime、openkal-image、openkal-platform、openkal-conformance,新增 openkal-freebsd、openkal-posix);
Expand Down Expand Up @@ -592,6 +592,10 @@ B 路线在 Windows 上就是正确的默认。
| I1 | compat.glfw 的 Windows 行要求 `mcpp:c-abi=ucrt` | gnu 行构建、windows-musl 行在解析期拒绝(实测) |
| CI 中暴露并修复 | 提供者的基座在依赖图载入前被记住(改为图载入后才保留);没有 cfg 的 Windows llvm 载荷编译时不陈述配对的 sysroot;同一 home 的两个进程并发安装同一个包(安装次序锁 `registry/.install.lock`) | target-matrix、openkal 交叉构建、各宿主 e2e |
| 实施中发现并修复 | 工具链为另一目标构建的 C++ 归档(其父目录的三元组与目标的架构或系统不同)不链接,并给出降级诊断;ok 映像的启动器依赖 mcpplibs.os 0.4.4(openkal 0.24 与 0.25 两族均可);交叉 gcc 自身的 Windows 头文件属于工具链(`mingw` 提供者下资源脚本的 `"winres.h"`);资源脚本中各处都找不到、也无构建动作写出的带引号 include 不进入构建图,由脚本的预处理与资源编译器处理 | 单元测试 `Distribution/ForeignArchivesAreNotLinked`;mingw 交叉打包;e2e 1058、1072(验证工程的 Windows 行暴露) |
| K9(mcpp 2026.11.10.2) | `<arch>-freebsd-musl` 两行由 openkal 提供者经 openkal-platform 0.26.0 的 hosted 部分服务(openkal-freebsd standalone 之上的 openkal-musl 0.29.2);未为 `<arch>-freebsd` 选平台时取该身份,选了平台则保留系统 ABI;openkal-run 0.6.1 在 FreeBSD 上以 openkal-freebsd 为缺省实现,okrun 由两条路线构建;平台的运行器主机加入 FreeBSD | e2e 1073、1059;openkal-platform CI 的 freebsd 作业(FreeBSD 虚拟机中运行程序,并以 FreeBSD 的 okrun 运行 ok 映像) |
| I1 的补正(mcpp 2026.11.10.2) | MSVC 载荷的 `c-abi` 回答 `ucrt`(此前为工具集名 `msvc`),`compat.glfw` 的 `requires = ["mcpp:c-abi=ucrt"]` 在 MSVC 行上成立;SPEC-002 v1.7 写明段与 C 库名的对应 | 单元测试 `TargetSideResolve`;mcpp-index#748 的 Windows 作业 |
| E15(mcpp 2026.11.10.2) | cfg 裸词由数据决定:`unix` 为族词,其余不含短横线的词即 `os = "<词>"`;行表的 `family` 陈述族,FreeBSD 各行属 `unix` 族;词表与诊断由行的系统生成,平台定义的系统同样可作裸词 | 单元测试 `CfgBarewords`;docs/22 |
| #918 的修正(mcpp 2026.11.10.2) | 依赖表仅当 `path`/`version`/`git` 为字符串或 `workspace` 为布尔时视为单个依赖说明,命名空间中名为 `version` 等的包按包读取 | 单元测试 `Manifest/APackageNamedLikeASpecField` |

openkal 家族(K5、K6,openkal 0.25.0)、openkal-freebsd 0.1.0(hosted 与 standalone 两种形态,x86_64 与 arm64)、
openkal-musl 0.29.1 与 openkal-llvm-runtime 0.20.1(FreeBSD 的 standalone C 与 C++ 运行时)以及 mcpplibs/os 的实施记录
Expand Down
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,63 @@
> Each `## [<version>]` section is that release's notes. Entries are written in English
> from 2026.9.28.3 on; earlier entries remain as written.

## [2026.11.10.2] - 2026-11-10

### Added

- FreeBSD's musl identity is served: `x86_64-freebsd-musl` and
`aarch64-freebsd-musl` are preview rows of the openkal provider, through
openkal-platform 0.26.0's hosted part — openkal-musl 0.29.2 over
openkal-freebsd 0.1.0 in its standalone arrangement, with
openkal-llvm-runtime 0.20.1 above it, as one static program with no C library
of the system beneath. A request of `<arch>-freebsd` with no platform selected
for it takes this identity, as `aarch64-macos` takes the musl identity on a
host that is not a Mac; a project that selects a platform for `<arch>-freebsd`
keeps the system's own ABI, by whichever selector chose it (`[target.<row>]`,
`[target.freebsd]` or `cfg(os = "freebsd")`): a platform package chosen for a
request that no built-in provider names serves it, and another package's
provider does not compete with it.
- A cfg bareword names any system a row names: `unix` is the family word, and
any other word without a dash is `os = "<word>"`, so `[target.freebsd]`,
`cfg(freebsd)` and the system of a row a platform defines select as `linux`
does. A row states its family (`family`, `unix` or `windows`), and FreeBSD's
rows are of the `unix` family, so `cfg(unix)` holds on them. A word that
names no row's system is reported as before.

### Changed

- The openkal targets' platform is openkal-platform 0.26.0 (from 0.25.0): its
version group is openkal-image 0.6.1, whose runner binds only the interfaces
its implementation provides and is built for FreeBSD as well, openkal-musl
0.29.2, openkal-llvm-runtime 0.20.1 and openkal-freebsd 0.1.0.

### Fixed

- The MSVC payload's C library is `ucrt`, as the MinGW-w64 payload's is: the
triple's env segment names the toolset on Windows, `msvc` and `gnu` alike.
It was answered as `msvc`, so `requires = ["mcpp:c-abi=ucrt"]` (a Win32
backend's statement of its C runtime) refused the MSVC route while the GNU
routes satisfied it. SPEC-002 v1.7 states the names.
- A dependency namespace holding a package named `version`, `path`, `git` or
`workspace` is read as the namespace (#918): `gpp.version = { path = "…" }`
declares the package `gpp.version`. A table was taken as one dependency
specification when it held any of those keys, whatever their values, and was
refused for naming no source; a specification's `path`, `version` and `git`
are strings and its `workspace` a boolean, and only such a value decides it.
- A platform refused for a row it does not serve names the rows its providers
serve; the list named only its `targets` and was empty for a platform that
states `[[platform.provider]]`.
- A test of an unchanged project that this host cannot execute is reported for
the host's target: `mcpp test` without planning (2026.11.10.1) named an empty
target in the refusal and in the `[target.…].runner` it proposes.
- A compiler record that Windows refuses to a reader for longer than the
publication bound is asked for again at the witness's next audit, as an
unknown controller already was; the refusal ends the build only when it
outlasts the startup grace. It ended a Windows build with "a compiler
controller ended before completion" after a large package installation. The
target-matrix scan reports the supervision's own `mcpp:` lines with a failed
cell.

## [2026.11.10.1] - 2026-11-10

### Added
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ list` reports for this machine):
| `aarch64-linux-gnu` | `llvm@23.1.3` | preview |
| `aarch64-windows-gnu` | llvm 23 with `xim:mingw-w64-sysroot` (llvm-mingw's target side) — built on any host; the same base serves `x86_64-windows-gnu` where no gcc payload exists | preview |
| `x86_64-freebsd` · `aarch64-freebsd` | the platform that serves them, over `xim:<arch>-freebsd-sysroot` ([22](docs/22-target-side.md)) | preview |
| `riscv64-linux-musl` · `x86_64-macos` · `x86_64-freebsd-musl` · `aarch64-freebsd-musl` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
| `x86_64-freebsd-musl` · `aarch64-freebsd-musl` | llvm 23 — a static FreeBSD program with a musl C library over openkal-freebsd, built on any host *(what `<arch>-freebsd` is with no platform chosen)* | preview |
| `riscv64-linux-musl` · `x86_64-macos` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
| `x86_64-openkal` · `aarch64-openkal` | llvm 23 — an ok image: one artifact per architecture, run by `okrun` on Linux, macOS and Windows; the C library and C++ run-time inside it are packages ([24](docs/24-openkal-cross.md)) | verified |
| `wasm32-emscripten` | `emsdk@6.0.9` — Emscripten ships its own sysroot and its own libc++ module surface; `mcpp run` executes the module with the `node` the payload declares (`xim:node`), not one found on PATH | verified |
| `x86_64-linux-android` | `android-ndk@30.0.16248370` — bionic from the NDK, one payload for both ABIs; ran on an API 24 x86_64 emulator image | verified |
Expand Down
3 changes: 2 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ mcpp 的身份模型有两条正交的轴:**工具链**是 `family@version`(
| `aarch64-linux-gnu` | `llvm@23.1.3` | preview |
| `aarch64-windows-gnu` | llvm 23 加 `xim:mingw-w64-sysroot`(llvm-mingw 的目标侧);任意宿主可构建;没有 gcc 载荷之处同一基座也服务 `x86_64-windows-gnu` | preview |
| `x86_64-freebsd` · `aarch64-freebsd` | 服务它们的平台,基于 `xim:<arch>-freebsd-sysroot`([22](docs/zh/22-target-side.md)) | preview |
| `riscv64-linux-musl` · `x86_64-macos` · `x86_64-freebsd-musl` · `aarch64-freebsd-musl` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
| `x86_64-freebsd-musl` · `aarch64-freebsd-musl` | llvm 23;openkal-freebsd 之上带 musl C 库的静态 FreeBSD 程序,任意宿主可构建 *(未选平台时 `<arch>-freebsd` 即此身份)* | preview |
| `riscv64-linux-musl` · `x86_64-macos` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
| `x86_64-openkal` · `aarch64-openkal` | llvm 23;ok 映像:每种架构一个产物,由 `okrun` 在 Linux、macOS 与 Windows 上运行;映像内的 C 库与 C++ 运行时是包([24](docs/zh/24-openkal-cross.md)) | verified |
| `wasm32-emscripten` | `emsdk@6.0.9`;Emscripten 自带 sysroot 与 libc++ 模块接口;`mcpp run` 使用 payload 声明的 `node`(`xim:node`)运行模块,不使用 PATH 上的 `node` | verified |
| `x86_64-linux-android` | `android-ndk@30.0.16248370`;bionic 来自 NDK,一个 payload 服务两个 ABI;已在 API 24 的 x86_64 模拟器镜像上运行 | verified |
Expand Down
5 changes: 3 additions & 2 deletions docs/21-the-target-triple.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ other's rows.
| `aarch64-macos-musl` | preview | `llvm@23.1.3` | graph | graph | graph | graph |
| `x86_64-macos-musl` | preview | `llvm@23.1.3` | graph | graph | graph | graph |
| `x86_64-freebsd`, `aarch64-freebsd` | preview | — | platform | platform | platform | platform |
| `x86_64-freebsd-musl`, `aarch64-freebsd-musl` | planned | — | planned | planned | planned | planned |
| `x86_64-freebsd-musl`, `aarch64-freebsd-musl` | preview | `llvm@23.1.3` | graph | graph | graph | graph |
| `riscv64-none-elf` | verified | `llvm@23.1.3` | payload | payload | payload | payload |
| `riscv32-none-elf` | verified | `llvm@23.1.3` | payload | payload | payload | payload |
| `aarch64-none-elf` | preview | `llvm@23.1.3` | payload | payload | payload | payload |
Expand Down Expand Up @@ -573,7 +573,8 @@ vocabulary, nothing wired yet.
| `*-linux-gnu` | Linux, same arch only | additionally needs the host-native `xim:glibc` / `xim:linux-headers` |
| `x86_64-windows-gnu` | Linux and Windows by the gcc payload; every host by the MinGW-w64 base package | one identity, host-split at the distribution layer; the `mingw-llvm` provider serves it with clang and `xim:mingw-w64-sysroot` (llvm-mingw's target side: MinGW-w64 on UCRT, libc++, compiler-rt) where no gcc payload exists |
| `aarch64-windows-gnu` | every host | the MinGW-w64 base package alone; no gcc payload targets it |
| `*-freebsd` | every host, through a platform | the rows are built-in; a platform names each identity's FreeBSD base package (`xim:x86_64-freebsd-sysroot`, `xim:aarch64-freebsd-sysroot`) and is selected with `[target.<row>] platform`; without one the request is refused naming that line |
| `*-freebsd` | every host, through a platform | the rows are built-in; a platform names each identity's FreeBSD base package (`xim:x86_64-freebsd-sysroot`, `xim:aarch64-freebsd-sysroot`) and is selected with `[target.<row>] platform`, or by any selector the row meets (`[target.freebsd]`, `cfg(os = "freebsd")`); another platform package's provider does not compete with the chosen platform |
| `*-freebsd-musl` | every host, through the graph | openkal-platform's hosted part (0.26.0): openkal-musl over openkal-freebsd standalone, one static program; a request of `<arch>-freebsd` with no platform selected for it takes this identity (2026.11.10.2+), as `aarch64-macos` takes the musl identity on a host that is not a Mac |
| `x86_64-windows-msvc` | Windows | MSVC is located on the machine |
| `x86_64-windows-musl` | Windows by payload; anywhere by graph | no gcc emits PE+musl, and LLVM cannot spell the triple |
| `aarch64-macos` | macOS | the SDK is the machine's |
Expand Down
20 changes: 14 additions & 6 deletions docs/22-target-side.md
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,9 @@ cxxflags = ["-D_GNU_SOURCE"]
**A layer names the library, not the triple's env segment.** They coincide
for `musl` and diverge for `gnu`: on Linux that segment asks for glibc, and on
Windows it names the MinGW flavour of the toolchain, whose C runtime is the same
UCRT the MSVC flavour links. The spelling is `c-abi = "glibc"`, never
UCRT the MSVC flavour links. Both Windows payloads answer `ucrt` (the MSVC one
from 2026.11.10.2), so a package that needs the Win32 C runtime states
`requires = ["mcpp:c-abi=ucrt"]` once. The spelling is `c-abi = "glibc"`, never
`c-abi = "gnu"`; the request, as opposed to the answer, is `env = "gnu"` — a
different question (`docs/specs/target-side.md` §3.4).

Expand Down Expand Up @@ -1091,15 +1093,21 @@ openblas = "0.3.33"
ldflags = ["-Llib", "-llibopenblas"]

# cfg(...) for compound predicates (grammar: all/any/not over os/arch/family/env,
# plus the bare aliases windows/unix/linux/macos).
# plus barewords: `unix` and the name of a system).
[target.'cfg(all(linux, not(arch = "aarch64")))'.build]
cxxflags = ["-march=x86-64-v2"]
```

`[target.windows]` is exactly equivalent to `[target.'cfg(windows)']` — the bare
aliases `windows` / `linux` / `macos` / `unix` are never valid target triples, so
there is no ambiguity. Use the bare form for a single OS/family; use `cfg(...)`
for arch/env conditions and combinators.
`[target.windows]` is exactly equivalent to `[target.'cfg(windows)']`. A bareword
is data rather than a list: `unix` is `family = "unix"`, and any other word without a
dash is `os = "<word>"` (`linux`, `macos`, `windows`, `freebsd`, or the system of a
row a platform defines). A row states its family (`family` in the row table), so
FreeBSD is of the `unix` family. A target triple always contains a dash, so a
bareword is never a triple. A word that names no row's system is reported, as an
unknown key is. Use the bare form for a single OS/family; use `cfg(...)` for arch/env
conditions and combinators. mcpp before 2026.11.10.2 reads only `linux`, `macos`,
`windows` and `unix` as barewords; a package read by such a release writes
`cfg(os = "<system>")` for any other system.

- **Keys**: `dependencies` / `dev-dependencies` / `build-dependencies` /
`feature-deps.<feature>` (mcpp 2026.8.6.2+ — see [30 — build.mcpp](30-build-mcpp.md); the feature is
Expand Down
4 changes: 2 additions & 2 deletions docs/35-platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ manifest,

```toml
[target.'cfg(os = "openkal")']
platform = "openkal-platform@0.25.0" # a release, or a series: "openkal-platform@^0.25"
platform = "openkal-platform@0.26.0" # a release, or a series: "openkal-platform@^0.26"
```

and a build that fails while the default is in use and the synced index holds a
Expand Down Expand Up @@ -311,7 +311,7 @@ hosted = true # the C environment has `main`

With the platform selected (`[target.x86_64-haiku] platform = {...}` or
`--platform`), `--target x86_64-haiku` builds into `target/x86_64-haiku/`,
`cfg(os = "haiku")` holds, and a program whose system is not this machine's
`cfg(os = "haiku")` holds (and `cfg(haiku)`, `cfg(unix)` by the row's `family`, 2026.11.10.2+), and a program whose system is not this machine's
is built, not run, until a runner states how it runs (docs/41). The row's
machine description is the platform's: a target whose machine differs from a
built-in row is another row. `[platform]` and `[platform.hosted]` remain the two
Expand Down
2 changes: 1 addition & 1 deletion docs/50-machine-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ installation, which is located on the machine rather than installed by mcpp. A
target row is `{target, note, toolchain, pin, status, default}`, and `status` is
one of `installed` / `available` / `via dependency graph` / `planned`.
A target row also carries `platform` (2026.10.27.1+): the platform package the
target table selects for it (`mcpplibs.openkal-platform@0.25.0` from 2026.11.10.1, `@0.24.4` from 2026.11.8.1, `@0.24.3` in 2026.11.7.2; the series `^0.24` in 2026.11.7.1), or `null`.
target table selects for it (`mcpplibs.openkal-platform@0.26.0` from 2026.11.10.2, `@0.25.0` in 2026.11.10.1, `@0.24.4` from 2026.11.8.1, `@0.24.3` in 2026.11.7.2; the series `^0.24` in 2026.11.7.1), or `null`.

**`toolchain` and `pin` are not the same field twice.** `toolchain` is what
the row is associated with — the installed payload on an installed row, the
Expand Down
2 changes: 1 addition & 1 deletion docs/specs/platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ run_under = ["qemu-aarch64"]
## 14. 内置平台与目标表

宿主目标(Linux、macOS、Windows、Android、iOS、Emscripten)的约定留在引擎中,无平台包。目标表有平台列:
`x86_64-openkal`、`aarch64-openkal` 的值为一个确切的平台版本,即当前引擎验证过的版本(mcpp 2026.11.10.1 为 `mcpplibs.openkal-platform@0.25.0`),
`x86_64-openkal`、`aarch64-openkal` 的值为一个确切的平台版本,即当前引擎验证过的版本(mcpp 2026.11.10.2 为 `mcpplibs.openkal-platform@0.26.0`),
也是这两个目标的内置支持;选择来源报告为 `built-in`。项目可以以 `[target.<selector>] platform` 选择另一个版本或系列。
锁中记录的版本不满足内置版本时不被采用,报告写出采用的版本与锁中记录的版本。使用内置版本的构建失败、且已同步的索引中
有更新版本时,构建以一条 `tip` 写出两个版本与选择它的写法(mcpp >= 2026.11.7.2;2026.11.7.1 的值为系列 `^0.24`)。**已实现**
Expand Down
Loading
Loading