Skip to content

feat(loongarch64): 添加龙芯架构(loongarch64)支持,与 QEMU CI 构建 - #257

Open
mujianwu wants to merge 18 commits into
VallierDev:mainfrom
mujianwu:main
Open

mujianwu wants to merge 18 commits into
VallierDev:mainfrom
mujianwu:main

Conversation

@mujianwu

Copy link
Copy Markdown

前言

为项目添加 loongarch64(龙芯)支持,并让每次发版都自动构建 loong64 的安装包。

具体内容:

  • 使龙芯设备上能够安装与运行本项目 —— 官方客户端扫码登录、桌面画面、键鼠控制全部正常(X11 会话实测)
  • 每次发版自动多出两个资产,命名与 x86_64/aarch64 完全同形:
    • uu-remote-linux-v<version>-loongarch64-linux.tar.gz + .sha256
    • uu-remote-linux_<version>_loong64.deb + .sha256
  • workflow_dispatch 也可以手动触发龙芯构建做测试,不必须与发版一起

x86_64 与 aarch64 的代码路径和产物完全不变,只有 3 行真正的逻辑改动(两条 [patch.crates-io] 条目、build-deb.sh 一个 case 分支),其余是 vendored 依赖和新增的 CI workflow。


改动清单

文件 改动
vendor/nix/ 新增(108 文件,1.7 MB):nix 0.26.4 + 1 行补丁
vendor/rcgen/ 新增(29 文件,282 KB):rcgen 0.11.3 + 3 处 API 补丁
Cargo.toml [patch.crates-io] 里挂上这两个 path 依赖(+6 行)
Cargo.lock ring 收敛到单版本 0.17.14,移除 ring 0.16.20 / spin 0.5.2 / untrusted 0.7.1
vendor/webrtc/Cargo.toml 去掉对 rcgen 的 x509-parser feature(-1 行)
packaging/deb/build-deb.sh uname -m 映射表增加 loongarch64 → loong64(+1 行)
.github/workflows/loongarch64.yml 新增 qemu 构建 + 发布 workflow
AGENTS.md 补充 vendored crate 与 loong64 CI 的说明(+6 行)

非 vendor 部分合计 +402 / -50 行,其中 .github/workflows/loongarch64.yml 占 374 行,Cargo.lock 的 63 行变化是 ring 收敛的连带结果。

三个架构名不同是刻意的,不能互相替代:

  • rustc 的 target_arch 是 loongarch64
  • C 预定义宏是 __loongarch64
  • Debian 的包架构名是 loong64(AOSC 那边用 loongarch64,本 PR 按 Debian/Deepin 走 loong64)

为什么需要动依赖

  • nix 0.26.4(webrtc-util 锁定):ioctl request-code 表按 target_arch 显式列举,loongarch64 一个都匹配不上,crate 直接编译不过
  • rcgen 0.11.3:把 ring 锁在 0.16,而 ring 0.16.20 的 P-256 / curve25519 只有 x86/arm 汇编,loongarch64 链接时缺 GFp_nistz256_* 符号

这两个 crate 除了打补丁没有别的路(nix 0.26 早已不维护、webrtc-util 又锁死在 0.26),所以按 vendor/webrtc-dtls 已有的惯例,把它们 vendored 进来各改一处。另外 build-deb.sh 的架构映射表本来就不认识 loongarch64,加上一行即可。

至于 CI —— GitHub 没有 loongarch64 托管 runner,所以新增了一条 qemu 构建路径(见下文)。


引入文件的出处

vendor/nix — nix 0.26.4

  • 来源:crates.io nix 0.26.4(https://crates.io/crates/nix/0.26.4),许可证 MIT,上游 LICENSE 原样保留
  • 只 vendored crate tarball 的内容(Cargo.toml、Cargo.toml.orig、src、test),不含 registry 的 .cargo-ok 标记和编辑器备份
  • 为什么要动它:webrtc-util 0.8.1 依赖 nix 0.26.2(锁定到 0.26.4)。这个版本的 src/sys/ioctl/linux.rs 用显式 target_arch 列表来选择 ioctl request-code 表,loongarch64 一个都匹配不上(既不是 “generic” 表,也不是 mips/powerpc/sparc 那张),于是 pub use self::consts::*; 解析失败,整个 crate 在 loongarch64 上编译不过
  • 唯一改动:src/sys/ioctl/linux.rs:46 给 “generic” 表加上 target_arch = "loongarch64"。LoongArch 的 ioctl 编码就是 8/8/14/2 位布局,和 x86/arm/s390x/riscv 同一张表,所以这是正确的那张。已经匹配到表的架构一个字节都没动
  • 细节见 vendor/nix/PATCHES.md

vendor/rcgen — rcgen 0.11.3

  • 来源:crates.io rcgen 0.11.3(https://crates.io/crates/rcgen/0.11.3,上游仓库 github.com/est31/rcgen),许可证 MIT OR Apache-2.0,两份上游许可证原样保留
  • 为什么要动它:rcgen 0.11.3 把 ring 锁在 0.16,而 ring 0.16.20 的 P-256 和 curve25519 只有 x86/arm 汇编实现,loongarch64 链接时会因未定义的 GFp_nistz256_* / GFp_x25519_* 失败。ring 0.17.x 这几条曲线是纯 Rust 实现,能编到 loongarch64;而且 vendor/webrtc-dtls 本来就要 ring 0.17,等于把项目里的 ring 收敛成一个版本
  • 改动共 3 处,都是 ring 0.16 → 0.17 的 API 差异,不涉及任何行为:
    1. Cargo.toml:ring = "0.16" → "0.17"
    2. src/error.rs:ring 0.17 删掉了 KeyRejected::description_(),RcgenError::RingKeyRejected 改为接收 &'static str,用 Box::leak(format!("{:?}", err).into_boxed_str()) 生成
    3. src/key_pair.rs:EcdsaKeyPair::from_pkcs8 在 ring 0.17 多了一个 &SystemRandom 参数
  • 除这 3 处外,其余文件与 crates.io 上的 0.11.3 逐字节一致(diff -rq 核对过)。证书格式、密钥类型、wire 行为都不变;ring 0.17 在 x86/arm 上仍然走原来的汇编后端,所以其他架构的性能不受影响
  • 细节见 vendor/rcgen/PATCHES.md

vendor/webrtc 的一行改动

vendor/webrtc 里 rcgen 依赖开着 x509-parser feature,会拖进 asn1-rs/nom 一整套,而本项目从不调用那段代码,所以把它去掉了。注意 webrtc-dtls 自己仍然依赖 x509-parser,因此这个 crate 还在依赖树里,只是 webrtc 不再主动启用它。


龙芯上的库支持情况(实测,Deepin 23.1 / 3A6000)

uuremote-server doctor 的实际输出(脱敏后):

version                v0.2.62 loongarch64
glibc                  2.38
os                     Deepin 23.1
build features         wayland, portal, engine-plugins
...
libuu-wayland.so       loaded
libuu-portal.so        could not be loaded: libei.so.1: cannot open shared object file
...
ffmpeg encoders        libx264, libx265, h264_vaapi, hevc_vaapi
ffmpeg version         6.1.1-2deepin0
nvidia driver          false
render node            writable

逐项说明:

组件 loong64 状态 说明
glibc 2.38(Deepin 23.1 / 25 crimson 同代) 产物按 ≤ 2.38 链接,CI 里有断言守着
GTK3 3.24.41 有,登录窗口正常;deb 里 readelf -d 确认链上了 libgtk-3
SDL2 2.30.11 有,uuremote-viewer 能编出来
Wayland(wayland-client / xkbcommon / wayland-scanner) 1.23.0 / 1.6.0 / 有 有,libuu-wayland.so 能编、能加载
PipeWire 1.2.5 有(portal 引擎的编译依赖)
libei Deepin 23 源里没有 编译期用的是 crimson 镜像里的 libei-dev,所以 libuu-portal.so 编出来了;但 Deepin 23 的 apt 源里没有 libei1,运行时 dlopen 失败,GNOME/KDE portal 会话在这个系统上不可用。deb 里 libei1 本来就只是 Suggests,不影响安装,X11 和 wlroots 路径完全正常
FFmpeg 6.1.1(deepin 打包) 有,且带 h264_vaapi / hevc_vaapi,硬件编码可用
NVENC 无 龙芯机器没有 NVIDIA 卡,inproc-av 本来也不是 release 特性,未启用
uinput 需要 udev 规则 和 x86 一样,deb 里那份 60-uu-remote-linux-uinput.rules 照旧提供

总结:X11 与 wlroots Wayland 路径完整可用;GNOME/KDE portal 路径的插件能编出来,但要用户自己装上 libei1 才能用,而 Deepin 23 目前没有这个包。


CI 脚本(.github/workflows/loongarch64.yml)

由于没有原生 runner,workflow 在 linuxdeepin/deepin:crimson-loong64 容器内通过 qemu-user 执行常规本机构建(不做交叉编译):

  • 基础镜像与 ABI 守卫:选用 Deepin crimson(glibc 2.38)而非 Debian trixie(glibc 2.41,会导致链接到 GLIBC_2.39 符号而无法在 Deepin 23 运行),并在构建后用 readelf 断言最高 glibc 符号版本不超过 2.38。
  • 链接器:容器内 binutils 2.41 的 ld 不支持 rustc 默认传入的 -Wl,--no-rosegment,通过包装 clang 调用 sysroot 自带的 rust-lld 解决。
  • 特性探测与缓存:按容器内依赖自动探测 wayland / portal(libei-1.0 >= 1.1),强制要求 GTK3 链接成功;以镜像 tag + Cargo.lock 哈希缓存 target/(冷构建约 1 小时,命中缓存约 24 分钟)。
  • 发布触发:通过 workflow_run 挂载在 Release 成功后执行(另保留 workflow_dispatch 手动触发),产物命名与 release.yml 保持一致(tar.gz、deb 及各自 .sha256)。因 qemu 下跑全量测试耗时过长,本 job 仅做构建与二进制校验,未跑 cargo test。

关于 rcgen 的版本

vendor/rcgen 是本次 diff 体积的主要来源之一(282 KB),如果愿意升版本,可以删掉这部分。

我核对了 rcgen 的发布历史:ring 0.17 的升级在 rcgen 0.12.0 就已经由上游自己做了,这 3 处补丁,与 0.12.0 官方的改法基本一致(RcgenError 变成 Error 的 #[deprecated] 别名,description_() 的替代和 from_pkcs8 的第三个参数都已适配)。也就是说我们 vendored 的这些东西,上游已经做完了。

本项目对 rcgen 的用法只有 generate_simple_self_signed(src/wallpaper.rs:358、src/ws_transport_tests.rs:193)和 vendor/webrtc 内部那几处,API 面很窄,升到 0.12.x 的适配成本很低。但我没有在这个 PR 里顺手升级,原因有两个:

  1. 这不是龙芯支持的必要条件 —— 现有 vendor 方案已经能编、能跑、能测;
  2. 升版本会牵动 Cargo.toml 的 dev-dependency(第 69 行也写着 rcgen = "0.11.3")和 Cargo.lock,属于独立的一次依赖升级。

vendor/nix 是没有这个选项了 —— nix 0.26 已经很久不维护了,而 webrtc-util 又把它锁在 0.26,除了打补丁没有别的路。


测试

CI

loongarch64.yml 在本仓库 fork 上跑过 6 次,最新一次(提交 b860828,workflow_dispatch)success,耗时 24 分钟;冷缓存(首次)约 1 小时。CI 内的校验项全部通过:GTK3 已链接、 glibc 符号版本 2.38、Architecture: loong64、产物命名与校验和齐全。

实机

6EEB58A4576105C7CFB3323E58585503

龙芯 3A6000(Loongson 3A6000-HV),Deepin 23.1,内核 6.12.20-loong64,glibc 2.38:

  • dpkg -i uu-remote-linux_0.2.62_loong64.deb 安装成功,dpkg -l 显示 ii uu-remote-linux 0.2.62 loong64
  • Depends 全部在 Deepin 23 源里可解析(libc6 >= 2.38、libgtk-3-0、libx11-6、libxext6、libxfixes3、libxtst6、ffmpeg 等)
  • uuremote-server doctor 输出见上,version v0.2.62 loongarch64、build features wayland, portal, engine-plugins
  • 用官方客户端扫码登录、建立会话、桌面画面与控制均正常(X11 会话)
  • libuu-wayland.so 能加载;libuu-portal.so 因系统缺 libei1 加载失败,属预期(见上表)
  • tar.gz 包解压后 install.sh 正常工作(脚本用 dirname $0 定位,不依赖目录名)

x86_64 / aarch64 侧没有回归验证 —— 本 PR 不涉及它们的代码路径,Cargo.lock 里 ring 从 0.16/0.17 双版本收敛为 0.17 单版本,这是 rcgen 补丁的直接结果,vendor/webrtc-dtls 本来就在用 0.17。

mujianwu and others added 11 commits November 19, 2026 23:02
Two vendored dependency patches, the deb architecture mapping, and a
qemu-based CI workflow. x86_64 and aarch64 keep the same code paths.

- vendor/rcgen (0.11.3): ring 0.16 -> 0.17. ring 0.16.20 implements P-256 and
  curve25519 only as x86/arm assembly, so a loongarch64 link fails on
  GFp_nistz256_*; ring 0.17 is pure Rust for those curves. Two API adjustments
  follow: KeyRejected::description_() is gone, and EcdsaKeyPair::from_pkcs8
  takes an extra &SystemRandom.
- vendor/nix (0.26.4): add loongarch64 to the ioctl table's target_arch list.
  The crate picks the table by explicit architecture with no fallback, so
  webrtc-util's nix 0.26 does not compile there.
- vendor/webrtc: drop rcgen's x509-parser feature, which pulls asn1-rs/nom for
  code this project never calls.
- packaging/deb/build-deb.sh: map uname -m loongarch64 to the Debian port name
  loong64. The three names differ on purpose: rustc target_arch is
  loongarch64, the C macro is __loongarch64, the package architecture is
  loong64.
- .github/workflows/loongarch64.yml: GitHub has no loongarch64 runner, so run
  the ordinary native build inside a ghcr.io/loong64/debian container under
  qemu-user. Each phase records its own failure and the run reports all of
  them at once, because a single pass costs hours; diagnose_only probes the
  toolchain and skips the build.
Found by the first diagnose_only run on the real loong64 container.

- The wayland probe asked pkg-config for "libwayland-client", which is the
  Debian package name, not the module name build.rs looks up. The run reported
  the module MISSING while libwayland-dev had installed fine, so the wlroots
  engine would have been dropped from a package that could have built it.
  build.rs line 145 uses "wayland-client"; use the same name here.
- wayland-scanner is a binary that build.rs shells out to for the protocol
  bindings, so pkg-config cannot see it. Probe it explicitly: without it the
  build fails at compile time instead of during the environment report.
- The apt phase took 7 minutes and printed nothing, because every line went to
  /tmp/apt.log. Echo the tail when the group closes, otherwise a diagnose run
  cannot show what it actually installed.
The trixie-based build produced a binary that cannot start on Deepin 23:

    uuremote-server: /lib/loongarch64-linux-gnu/libc.so.6:
    version `GLIBC_2.39' not found (required by uuremote-server)

trixie ships glibc 2.41, and linking against it binds the weak libc symbols
pidfd_spawnp and pidfd_getpid to GLIBC_2.39. Both are extern_weak and are
never reached on this code path, but the loader still refuses to map the
binary when the version node is missing, so the failure happens before main()
and cannot be worked around at runtime. Deepin 23 ships glibc 2.38 and has no
newer candidate in its repositories, so the build environment has to match the
target rather than the target catching up.

Build on linuxdeepin/deepin:crimson-loong64 instead: it is a loong64-native
Deepin 25 image that pins glibc 2.38, the same ABI generation as Deepin 23, and
its apt source carries every required and optional package (GTK3, Wayland,
PipeWire, libei, SDL2), so no feature is lost. Verified by extracting the image
layer: libc.so.6 exports only GLIBC_2.36 and GLIBC_2.38.

Also assert the ceiling after the build. Pinning the image fixes today's
problem, but a dependency bump could raise the floor again silently, and the
symptom only appears on the target machine. The check reads the version
requirements from the produced binary and fails the run above GLIBC_MAX (2.38).
The first Deepin-based run failed before compiling anything:

    error: linking with `cc` failed: exit status: 1
    /usr/bin/ld: unrecognized option '--no-rosegment'

rustc 1.100 emits -Wl,--no-rosegment by default, but GNU ld only gained that
option in binutils 2.43 and Deepin crimson ships 2.41, with no backports to
pull a newer one from. The trixie image hid this because its binutils is new
enough, so switching the base image traded one ABI problem for another.

Link with the LLD that ships inside the rustc sysroot instead. It is 23.1.5,
understands every flag rustc emits, and needs no extra package. clang stays
the driver because it supplies the library search paths: pointing rustc
straight at rust-lld loses -lm/-ldl/-lc, so ld.lld is symlinked onto PATH and
selected through -fuse-ld=lld. The distribution's own lld is not usable here
(17.x predates --rosegment entirely).

The linker is set through CARGO_TARGET_*_LINKER pointing at a small wrapper
rather than through RUSTFLAGS, so any flags a later step sets are preserved.
clang moves to the required package list, and cc::Build in build.rs is
unaffected because it drives the compiler directly for -shared objects and
never passes --no-rosegment.

Verified on the target hardware: a rustc build through this wrapper produces a
binary that links and runs, including with --no-rosegment forced.
The target dir holds objects linked against the base image's glibc, so a cache
restored across a base-image change mixes two ABIs and defeats the reason for
pinning the image in the first place. Switching from trixie to crimson would
have done exactly that on the first run, since the old key only hashed
Cargo.lock.

IMAGE_TAG is a separate variable because an image reference contains '/' and
':', which actions/cache keys cannot carry.
Attaching the packages used to race release.yml: both workflows started on the
tag push, so the loong64 job polled gh release view for up to fifteen minutes
waiting for the release to appear. Trigger on workflow_run of Release instead.
The release therefore exists before this job starts, the polling loop goes away,
and a Release that failed before its publisher job is skipped outright by the
job-level condition rather than discovered later.

The version now comes from Cargo.toml in the checked-out tree rather than from
workflow_run.head_branch, which is documented as a branch and is only
incidentally the tag name for tag pushes; the release tag is built as
v<version> and checked with gh release view before the hour-long build starts.

Also drop what only existed to debug the first runs:

- diagnose_only and run_tests inputs, and the environment report they served.
  workflow_dispatch still builds a branch on demand for testing.
- The per-package apt_install helper and its log tail. The base image is pinned,
  so a package missing from it is a regression that should fail the run; the
  feature probes below still degrade gracefully.
- The duplicated "show the produced packages" step.
release.yml publishes uu-remote-linux-v<tag>-<arch>-linux.tar.gz with a
per-asset .sha256, and uu-remote-linux_<version>_<arch>.deb likewise. The loong64
job produced uu-remote-linux-<version>-loongarch64-linux.tar.gz without the "v"
and collected both checksums into a single SHA256SUMS file, so the loong64
assets did not look like the rest of the release and tooling that expects
<asset>.sha256 next to <asset> would not find them.

Use the tag form for the tarball directory name and write one .sha256 per asset.
The deb already matched: build-deb.sh emits uu-remote-linux_<version>_loong64.deb.
The workflow moved to linuxdeepin/deepin:crimson-loong64 when the Debian
trixie image turned out to link GLIBC_2.39 weak symbols, but the AGENTS.md
note still named the old ghcr.io/loong64/debian image.
@VallierDev

Copy link
Copy Markdown
Owner

感谢龙芯支持和详细的说明!初步审查:

  1. 阻塞:vendor/nix 作为 path 依赖后不再享受 crates.io 依赖的 lint 上限(--cap-lints),它自带的 #![deny(unused)] 在当前 stable rustc 下会把 dead_code 警告变成错误。本地 cargo test --locked(macOS 维护机)直接失败:
    error: fields `1` and `2` are never read
    error: struct `GetOsString` is never constructed
    error: struct `SetOsString` is never constructed
    error: could not compile `nix` (lib) due to 3 previous errors
    
    建议在 vendor/nix/src/lib.rs 把 #![deny(unused)] 降为 #![warn(unused)](或加 #![allow(dead_code)]),并记进 PATCHES.md。本仓库 CI(含 macOS job)已批准运行,可看 Linux 侧结果。
  2. 与 feat(packaging): consolidate packaging assets and add Nix flake/module #258 冲突:feat(packaging): consolidate packaging assets and add Nix flake/module #258 把 contrib/desktop 移到 packaging/common/,且 install.sh 改为从 packaging/common 读取 unit/desktop。哪个后合,loongarch64.yml 的打包步骤都需要同步(拷贝 packaging/common)。
  3. 建议:linuxdeepin/deepin:crimson-loong64 是可变 tag,最好用 @sha256: digest 固定,否则缓存 key 与 glibc 下限都可能在不知情时漂移。

已请 Codex 审查,修完并且审查返回后再合并。

🤖 Generated with Claude Code

@VallierDev

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T13:25:18.839681Z e910ae2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33798c2e86

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread AGENTS.md
- CI (`.github/workflows/ci.yml`) runs `cargo test --locked` on ubuntu-22.04. Pushing a `v*` tag runs
`.github/workflows/release.yml`, which builds and publishes the x86_64 tarball; release notes come from
`docs/release-notes/<tag>.md`.
- `.github/workflows/loongarch64.yml` builds the loong64 deb/tarball by running the normal native build

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Document LoongArch installation in both user READMEs

The installation sections in README.md and README.en.md still advertise only x86_64/aarch64 and amd64/arm64 downloads; a repository-wide search found the new LoongArch support only in agent/CI/vendor material. Users therefore have no documented mapping to the loong64 deb or loongarch64-linux tarball, or guidance on the Deepin 23 portal limitation. Update both user guides: root AGENTS.md explicitly requires “Update README.md / README.en.md when user-visible features or limitations change.”

AGENTS.md reference: AGENTS.md:L303-L303

Useful? React with 👍 / 👎.

Comment thread .github/workflows/loongarch64.yml Outdated
# emulated crates costs hours. Both are saved even when the job fails, so a
# compile error does not throw the work away.
- name: Cache cargo registry and target dir
uses: actions/cache@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Save partially built caches on failed workflow runs

When an emulated build fails late, or a subsequent upload step fails after compilation, actions/cache@v4 does not save the newly built target/registry contents: its automatic save post-step is gated on job success. A retry therefore restores only an older successful cache, or none, discarding the expensive compilation work that the surrounding comment promises to preserve. Split restoration and saving, and run an explicit actions/cache/save@v4 step under an appropriate failure-tolerant condition so failed runs retain their progress.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/loongarch64.yml Outdated
apt-get install -y --no-install-recommends rustc cargo \
|| fail "neither rustup nor the distribution toolchain is available"
fi
export PATH="$CARGO_HOME/bin:$PATH"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bypass cached rustup proxies in the distribution fallback

On a cache-hit run where rustup download/installation fails, the restored $CARGO_HOME/bin can still contain cargo/rustc shims while the deliberately uncached /root/.rustup is empty. This unconditional PATH prepend selects those shims instead of the just-installed distribution binaries; rustup run --help describes these commands as “explicitly proxied by rustup”, and reproducing this layout exits with “no default is configured”. Consequently the advertised fallback still fails even when apt succeeds. Only prepend this directory after a usable rustup installation, or explicitly select the distribution binaries in the fallback branch.

Useful? React with 👍 / 👎.

@VallierDev

Copy link
Copy Markdown
Owner

Codex 审查意见补充(与前面的阻塞问题一起处理即可):

  • README.md / README.en.md 的安装章节需加上 loongarch64 tarball / loong64 deb 的说明,以及 Deepin 23 下 portal 的限制。
  • workflow 里 actions/cache 的保存只在作业成功时触发,失败重试会丢掉已编译的缓存;可拆成 restore + if: always() 的 actions/cache/save。
  • 回退到发行版 Rust 时,命中缓存的 $CARGO_HOME/bin 里的 rustup 代理会排在前面(报 “no default is configured”);回退分支应避开这些代理。

另外 vendor/nix 的 #![deny(unused)] 编译失败仍是合并前的阻塞项(CI 绿可能是工具链版本不同,本地 stable 会失败)。

🤖 Generated with Claude Code

A registry dependency is compiled with --cap-lints allow, so the
#![deny(unused)] in nix 0.26.4 never fired. As a path dependency that cap
is gone and the dead_code half of the lint is a hard error for items this
project never reaches (GetOsString, SetOsString and their fields on macOS).
Keep deny(unused) for the other unused lints and allow dead_code only.
…llback

Three problems reported in review:

- actions/cache saves in a post step that is skipped when the job fails,
  which is exactly the run whose target dir is worth keeping. Split it into
  actions/cache/restore plus an actions/cache/save step with if: always().
- The image was referenced by a moving tag while both the cache key and the
  glibc 2.38 floor assertion depend on its contents. Pin the digest.
- When rustup fails, $CARGO_HOME/bin from the cache still holds rustup's
  proxies, which shadow the distribution toolchain with 'no default
  toolchain is configured'. Remove them and keep that dir off PATH in the
  fallback branch.
Every release also publishes a loong64 deb and a loongarch64 tarball, but the
installation section only mentioned x86_64 and aarch64, and the GNOME/KDE row
of the session table silently does not apply on Deepin 23 because libei1 is
not packaged there.
install.sh reads the desktop entries and the systemd unit template from
packaging/common after the packaging refactor; the x86_64/aarch64 tarball in
release.yml already ships that directory, the loong64 one did not. The copy is
conditional so the same workflow works before and after the refactor lands.
@VallierDev

Copy link
Copy Markdown
Owner

感谢更新。新头 2ac9374 已在本地验证:cargo test --offline 390 通过(vendor/nix 的 dead_code 阻塞已解决);workflow 的 cache restore/save 拆分、镜像 digest 固定、rustup 代理回退处理和 README 说明均已看过,CI 已批准运行。

接下来等 CI 结果和 Codex 对新头的复审,返回后再决定合并。另外 #258 尚未合并,若它先合入,本 PR 可能需要再同步一次 main。

@codex review

🤖 Generated with Claude Code

@mujianwu

mujianwu commented Nov 20, 2026 •

Copy link
Copy Markdown
Author

您好,关于README要说明一下,deb 说明那行抬头是「Ubuntu / Debian(v0.2.18 起)」,这个 v0.2.18 是 deb 这个格式第一次出现的版本,和龙芯无关。龙芯包从哪个版本开始有,将取决于这个 PR 合进哪个 release,现在写不出来。我暂时在这行括号里写了「龙芯选 loong64」,没有另标版本号。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ac9374b22

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/loongarch64.yml Outdated
path: |
${{ runner.temp }}/loongarch/cache
${{ runner.temp }}/loongarch/target
key: loongarch64-${{ env.IMAGE_TAG }}-${{ hashFiles('Cargo.lock') }}-${{ github.run_id }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Give each retry attempt a distinct cache key

When a failed run saves a partial build and is retried with “Re-run jobs”, this key is reused because github.run_id remains unchanged between attempts (gh run view --help illustrates multiple attempts of one run with gh run view 12345 --attempt 3). The new explicit save's cache-hit != 'true' guard then suppresses saving any additional compilation progress—even when the retry successfully completes the build. Subsequent attempts keep restoring the first partial snapshot, and the completed cache is never published for future runs. Include github.run_attempt in both primary restore/save keys while retaining the existing restore prefixes so retries can preserve their additional QEMU compilation work.

Useful? React with 👍 / 👎.

github.run_id does not change between attempts of the same run, so a re-run
restored attempt 1's entry as an exact hit, cache-hit became 'true', and the
save step was skipped -- the completed target dir was never published and
later attempts kept restoring the first partial snapshot. Key on run_attempt
as well, on both the restore and the save side, and leave the restore prefixes
alone so an attempt still starts from whatever the previous one built.
@VallierDev

Copy link
Copy Markdown
Owner

感谢更新。新头 e910ae2 已核对:保存与恢复的 key 都加上了 run_attempt,restore-keys 前缀仍能取回上一次尝试的部分缓存,解决了 Codex 指出的重跑时 cache-hit 导致不保存的问题。README 中 deb 那行不标龙芯起始版本的处理没问题,合并发版时由我们在 release notes 里写明。

CI 已批准运行,再请 Codex 复审新头,返回无问题后合并。

@codex review

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: e910ae2bae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@VallierDev

Copy link
Copy Markdown
Owner

Codex 复审 e910ae2 无问题、CI 全绿,感谢!不过 #258 刚合并进 main(打包资源移到 packaging/common/、docker 移到 packaging/docker/,CI/release workflow 和 README 也有改动),本 PR 现在与 main 冲突。麻烦 rebase 到最新 main 并解决冲突(尤其 .github/workflows/*.yml、packaging/tarball/install.sh、README 中英两份);推送后 CI 通过即可合并。

🤖 Generated with Claude Code

# Conflicts:
#	AGENTS.md
#	packaging/deb/build-deb.sh
packaging/common exists on main since VallierDev#258 moved the desktop entries and the
systemd unit template there, so the transitional directory check can go and
the staging steps match release.yml exactly.
@VallierDev

Copy link
Copy Markdown
Owner

感谢 rebase!合并 main 后的新头 c0a2c15 已核对:冲突解决干净(README 中英、build-deb.sh、AGENTS.md 与 #258 的改动并存),loong64 tarball 现在与 release.yml 一样无条件打包 packaging/common。本地在合并后的树上 cargo test --locked 390 项通过。

CI 已批准运行,通过后合并。

🤖 Generated with Claude Code

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.

2 participants