Add riscv64-linux-musl-gcc cross GCC toolchain package - #585
Conversation
|
补充工具链资源信息,以及本 PR 与 mcpp 侧的联动: 工具链资产(已构建并发布,CI 24min 全绿):
ISA 范围:默认基础集 本地端到端实测:工具链手动装入本机 xpkgs 后, 联动:本 PR 合入后,mcpp 侧 planned→verified 已就绪 —— mcpp-community/mcpp#402。 |
XLINGS_RES would resolve to xlings-res/riscv64-linux-musl-gcc, which does not exist yet. Pin the artifact to the builder repo release (16.1.0) with explicit url + sha256 so xlings can fetch and verify it today; mirror to xlings-res later.
|
已更新描述符:资产改用显式 url + sha256 指向 builder 仓库 release,不再用 XLINGS_RES(因为 xlings-res/riscv64-linux-musl-gcc 尚未创建,XLINGS_RES 会解析到不存在的仓库导致 fetch 失败)。 现在合并后 xlings 可直接下载 + 校验 + 安装:
若合入后希望资产进 xlings-res,我可以把 release 资产同步过去,届时描述符可改回 XLINGS_RES。 |
|
@lildengzi 补充一下 工具链详细的构建参数 以及 可复现路径 |
|
补充构建参数、可复现路径、以及端到端运行 RISC-V Linux 的实测。 一、构建参数用 musl-cross-make 源码构建,x86_64 宿主交叉产出 riscv64 全静态工具链。 组件版本
config.mak GCC_VER = 16.1.0
GNU_SITE = https://mirrors.kernel.org/gnu
TARGET = riscv64-linux-musl
OUTPUT = riscv64-linux-musl-gcc-16.1.0-linux-x86_64
COMMON_CONFIG += CC="gcc -static --static" CXX="g++ -static --static"然后 二、可复现路径完整 workflow 在 三、端到端实测:RISC-V Linux 里跑工具链产物在 x86_64 宿主上,用本工具链交叉编译 # 1) 交叉编译(import std 全链路)
TC=<toolchain>/bin
$TC/riscv64-linux-musl-g++ -std=c++23 -fmodules-ts -c <toolchain>/.../bits/std.cc -o std.o
$TC/riscv64-linux-musl-g++ -std=c++23 -fmodules-ts demo.cpp std.o -static -o demo_riscv
file demo_riscv # ELF 64-bit UCB RISC-V, statically linked
# 2) 拉起 riscv64 Alpine(qemu-user binfmt)
podman pull --platform linux/riscv64 alpine:latest
distrobox create --name riscv-alpine --image alpine:latest
distrobox enter riscv-alpine -- uname -m # → riscv64
# 3) 在 RISC-V Linux 里运行工具链产物
distrobox enter riscv-alpine -- $HOME/demo_riscv实际输出: 即:x86_64 上交叉编译 → riscv64 Linux(qemu)里运行成功, |
Review:资产完备性通过,镜像已按 xlings-res 规范落地把资产拉下来做了实测(不是只核对描述),结论是完备,可以合。 一、资产验证
二、xlings-res 镜像已上线(三方 sha256 复核通过)按
从两个 forge 各自匿名回下完整 141MB 实测,builder release == GitHub == GitCode == 所以我直接在本分支补了一个 commit,让 用的是当前 spec 2 的写法( spec = "2",
...
["16.1.0"] = {
url = "XLINGS_RES",
sha256 = {
x86_64 = "dc85b0a63a6e4582e3122d9f64025d324b1f69c8dc57bb093ceba40a25aae5b2",
},
},裸字符串那种形式不带 checksum,等于让这个 141MB 工具链无校验安装 —— 这正是 spec 2 的 顺带一提, 三、顺带修正的注释(不影响功能)原 xpm 注释是从 aarch64 复制的,描述了一个并没有发生的构建,同一 commit 里已改:
另外 PR 正文里"XLINGS_RES sentinel"那句在第二个 commit 之后就过期了,现在又重新准确(且带上了 checksum)🙂 替换后的 recipe 与 LGTM。 |
b03ef7b to
0adcf48
Compare
…c 2) xlings-res/riscv64-linux-musl-gcc@16.1.0 is live on both forges (github + gitcode) carrying the same bytes as the builder release — three-way sha256 dc85b0a63a6e4582e3122d9f64025d324b1f69c8dc57bb093ceba40a25aae5b2, checked by downloading the asset back from each. So the explicit builder-repo URL is no longer needed: XLINGS_RES auto-URLs the host-matching asset for GLOBAL and CN alike, and CN users stop being routed at a GitHub release. Use the current spec-2 entry shape (`url = "XLINGS_RES"` + per-arch `sha256`, as in nasm/perl/mcpp) rather than the bare `["16.1.0"] = "XLINGS_RES"` string. The bare form carries NO checksum — it would install a 141MB toolchain unverified, which is the gap the spec-2 shape exists to close. spec bumped to "2" accordingly; the index already floors at that (53 recipes use it), so this moves no compat floor. Also correct the xpm comment, which was copied from aarch64 and described a build that did not happen: there is ONE host asset (x86_64), and it is glibc-static, not musl-static — the builder used the plain glibc gcc with `CC/CXX="gcc -static --static"` and no `-g0 -Os`/`LDFLAGS=-s`. Harmless here: verified no PT_INTERP, no NEEDED, stripped, and zero libnss_/__nss references, so "no deps / runs on a cold sandbox" still holds. The only cost is size (141MB vs aarch64's 114MB), noted inline for the next rebuild. Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
0adcf48 to
7069124
Compare
- triple.cppm: mark riscv64-linux-musl verified, pin gcc@16.1.0 - cross-build-test.yml: add riscv64-linux-musl qemu matrix row - 103_target_vocabulary.sh: use aarch64-linux-gnu as the planned-tier example - test_linkmodel.cpp: assert riscv64 loader names (musl + glibc) - README/README.zh-CN: riscv64-linux-musl now verified with rv64gc/lp64d note Requires xim riscv64-linux-musl-gcc@16.1.0 (openxlings/xim-pkgindex#585).
内容
新增
riscv64-linux-musl-gcc交叉工具链包(host →riscv64-linux-musl),与现有aarch64-linux-musl-gcc包对齐:pkgs/r/riscv64-linux-musl-gcc.lua:新增包描述符(XLINGS_RES sentinel,gcc 16.1.0,hostx86_64)。pkgs/m/musl-cross-make.lua:target_list增加riscv64-linux-musl,gcc_version_list增加16.1.0。资产
交叉工具链
riscv64-linux-musl-gcc-16.1.0-linux-x86_64.tar.gz(141MB)目前发布在 builder 分支lildengzi/riscv64-linux-musl-gcc(release16.1.0),由 musl-cross-make 构建(build=x86_64, host=x86_64, target=riscv64-linux-musl),全静态。CI 已构建并验证:
import std;hello,产物为ELF 64-bit LSB executable, UCB RISC-V, RVC, double-float ABI, statically linked。范围 / 非目标
该目标属于 hosted RISC-V Linux 用户态 ABI(
rv64gc/lp64d基础 ISA,musl),与aarch64-linux-musl同构,用于:它不是裸机 / freestanding 目标。mcpp 的嵌入式设计文档(
2026-07-24-embedded-platform-support-design.md决策 #15)已明确推迟裸机/freestanding,因此本包不覆盖 RISC-V 内核 / 固件(riscv64-none-elf、自定义link.ld、qemu-kernel启动)。可选 ISA 扩展(V 向量、Zb* 位操作)不属于基础三元组,需在构建时用-march=...指定——本工具链支持rv64gcv、rv64gc_zba_zbb等。上游说明
若合入,建议把资产镜像到
xlings-res/riscv64-linux-musl-gcc(org 所有),与其他工具链包保持一致(如xlings-res/aarch64-linux-musl-gcc)。本包落地后,mcpp 即可把
riscv64-linux-musl从planned提升为verified。