From 3bdee033e7221f2cccb1b08922db499f6852bbf2 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Fri, 21 Aug 2026 08:08:39 +0800 Subject: [PATCH] =?UTF-8?q?std-freestanding=200.5.0=20=E2=80=94=E2=80=94?= =?UTF-8?q?=20=E5=A4=B4=E5=8F=AF=E4=BB=A5=E6=9D=A5=E8=87=AA=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=8C=85,windows=20=E8=A1=8C=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E5=8F=AF=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows 的 llvm 载荷不带 libc++,于是 build.mcpp 从 0.5.0 起看第二处: 已安装的 xim:libcxx-headers。索引侧只需 windows 平台加一条 deps。 deps 是按平台而非按版本的,于是它也套到 0.2.0–0.4.0 上 —— 那几版在 Windows 上本来就构建不出来,代价是一次小下载。 --- pkgs/s/std-freestanding.lua | 64 +++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/pkgs/s/std-freestanding.lua b/pkgs/s/std-freestanding.lua index 12bc74d..d3f3138 100644 --- a/pkgs/s/std-freestanding.lua +++ b/pkgs/s/std-freestanding.lua @@ -5,13 +5,21 @@ -- directory, unfound, and the package would resolve and compile and then link -- against nothing. -- --- ⚠️ NO `deps`, and that is the design. This package needs libc++'s headers --- and the target's C headers, and it gets both by ASKING mcpp --- (`mcpp::toolchain_dir()`, and the target's libc which mcpp already puts on --- the compile line) rather than by declaring who provides them. Declaring --- pinned it to one standard-library implementation, one C library, one --- architecture and one version of each — none of which it has any business --- knowing about. +-- ⚠️ `deps` IS EMPTY ON TWO PLATFORMS OF THREE, AND THE EXCEPTION IS INSTRUCTIVE. +-- +-- The package needs libc++'s headers and the target's C headers, and it gets +-- both by ASKING mcpp (`mcpp::toolchain_dir()`, and the target's libc which +-- mcpp already puts on the compile line) rather than by declaring who provides +-- them. Declaring pinned it to one standard-library implementation, one C +-- library, one architecture and one version of each — none of which it has any +-- business knowing about. +-- +-- ⚠️ That holds as long as the toolchain payload CARRIES the headers, and the +-- Windows payload does not. From 0.5.0 the package looks in a second place — +-- an installed `xim:libcxx-headers` — and the windows block below declares it. +-- The rule survives: the package still does not name a C library or an +-- architecture. It names one missing artifact on the one platform that is +-- missing it. -- ⚠️ 0.3.0 AND 0.3.1's `alloc-kal` / `alloc-libc` features DO NOT WORK; 0.3.2 -- is the first that does. 0.3.0 named `0.1.x`, which the installer reports as a -- missing package; 0.3.1 named `0.1`, which resolves and then fails with @@ -71,6 +79,13 @@ package = { }, sha256 = "a0306d470f524f7ac32fca2ab46a46435a66dc0eb9b4960ada013a905f66b9a6", }, + ["0.5.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding/archive/refs/tags/0.5.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding/releases/download/0.5.0/std-freestanding-0.5.0.tar.gz", + }, + sha256 = "cb7c7fe4f2f6dd60784951262875d317e8a107642af01bad6ea4b3a106fc43f2", + }, }, macosx = { ["0.2.0"] = { @@ -108,8 +123,36 @@ package = { }, sha256 = "a0306d470f524f7ac32fca2ab46a46435a66dc0eb9b4960ada013a905f66b9a6", }, + ["0.5.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding/archive/refs/tags/0.5.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding/releases/download/0.5.0/std-freestanding-0.5.0.tar.gz", + }, + sha256 = "cb7c7fe4f2f6dd60784951262875d317e8a107642af01bad6ea4b3a106fc43f2", + }, }, windows = { + -- ⚠️ THE ONLY PLATFORM WITH A `deps`, AND IT IS A PROPERTY OF THE + -- TOOLCHAIN PAYLOAD RATHER THAN OF WINDOWS. + -- + -- This package needs libc++'s headers. On linux and macosx the + -- llvm payload ships them and `build.mcpp` finds them under + -- `mcpp::toolchain_dir()`; the Windows payload builds clang + -- against the MSVC standard library and ships no libc++ at all, + -- so there the headers have to come from somewhere. They come + -- from here. + -- + -- ⚠️ `deps` IS PER-PLATFORM, NOT PER-VERSION, so this also applies + -- to 0.2.0 through 0.4.0 -- which do not look for the package and + -- could not build on Windows at all. The cost is one small + -- download on a configuration that never worked; the alternative + -- is no mechanism for 0.5.0, which does. + -- + -- The version is pinned rather than `@latest` for the reason + -- compat.openssl pins glibc: these headers are read by the SAME + -- clang the payload ships, and a newer libc++ is free to require + -- a newer compiler than the one that will read it. + deps = { "xim:libcxx-headers@22.1.8" }, ["0.2.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/std-freestanding/archive/refs/tags/0.2.0.tar.gz", @@ -145,6 +188,13 @@ package = { }, sha256 = "a0306d470f524f7ac32fca2ab46a46435a66dc0eb9b4960ada013a905f66b9a6", }, + ["0.5.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/std-freestanding/archive/refs/tags/0.5.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/std-freestanding/releases/download/0.5.0/std-freestanding-0.5.0.tar.gz", + }, + sha256 = "cb7c7fe4f2f6dd60784951262875d317e8a107642af01bad6ea4b3a106fc43f2", + }, }, },