From 9d0012629bed19b5fb95ebafb11e6a940e976c80 Mon Sep 17 00:00:00 2001 From: 10000ge10000 <10000ge10000@users.noreply.github.com> Date: Tue, 17 Mar 2026 02:30:34 +0800 Subject: [PATCH] fix(ci): fix Node.js ARM64 musl build - use apk mode instead of cross - V2 build now uses Alpine nodejs-current package (v23.x) - V1 build now uses Alpine nodejs LTS package (v22.x) - Add PKG_TYPE environment variable to select package type - Update release notes to reflect new build approach The cross-compilation mode failed because Node.js official glibc binary cannot be converted to musl via patchelf due to glibc-specific dynamic linker dependencies. --- .github/workflows/build-node-musl.yml | 21 ++++++++++++--------- scripts/build-node-musl.sh | 11 ++++++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-node-musl.yml b/.github/workflows/build-node-musl.yml index b549cec..935f6c7 100644 --- a/.github/workflows/build-node-musl.yml +++ b/.github/workflows/build-node-musl.yml @@ -34,16 +34,17 @@ jobs: with: platforms: linux/arm64 - - name: Build Node.js V1 ARM64 musl (apk mode) + - name: Build Node.js V1 ARM64 musl (apk lts mode) run: | NODE_VER="22.15.1" mkdir -p dist - echo "=== Building Node.js v${NODE_VER} ARM64 musl (apk mode) ===" + echo "=== Building Node.js v${NODE_VER} ARM64 musl (apk lts mode) ===" docker run --rm --platform linux/arm64 \ -v "$PWD/dist:/output" \ -v "$PWD/scripts/build-node-musl.sh:/build-node-musl.sh:ro" \ -e "NODE_VER=${NODE_VER}" \ -e "BUILD_MODE=apk" \ + -e "PKG_TYPE=lts" \ alpine:3.21 sh /build-node-musl.sh - name: Build info @@ -86,16 +87,17 @@ jobs: with: platforms: linux/arm64 - - name: Build Node.js V2 ARM64 musl (cross mode) + - name: Build Node.js V2 ARM64 musl (apk current mode) run: | NODE_VER="22.16.0" mkdir -p dist - echo "=== Building Node.js v${NODE_VER} ARM64 musl (cross mode) ===" + echo "=== Building Node.js v${NODE_VER}+ ARM64 musl (apk current mode) ===" docker run --rm --platform linux/arm64 \ -v "$PWD/dist:/output" \ -v "$PWD/scripts/build-node-musl.sh:/build-node-musl.sh:ro" \ -e "NODE_VER=${NODE_VER}" \ - -e "BUILD_MODE=cross" \ + -e "BUILD_MODE=apk" \ + -e "PKG_TYPE=current" \ alpine:3.21 sh /build-node-musl.sh - name: Build info @@ -167,12 +169,13 @@ jobs: | 文件 | 版本 | 用途 | |------|------|------| - | `node-v22.16.0-linux-arm64-musl.tar.xz` | V2 (当前) | OpenClaw v2026.3.11+ (要求 >= 22.16.0) | - | `node-v22.15.1-linux-arm64-musl.tar.xz` | V1 (旧版) | OpenClaw v2026.3.8 及更早版本 | + | `node-v23.x.x-linux-arm64-musl.tar.xz` | V2 (当前) | OpenClaw v2026.3.11+ (要求 >= 22.16.0) | + | `node-v22.x.x-linux-arm64-musl.tar.xz` | V1 (旧版) | OpenClaw v2026.3.8 及更早版本 | ## 构建模式 - - **V2 (22.16.0)**: 交叉编译模式,从 Node.js 官方 glibc 版本转换为 musl - - **V1 (22.15.1)**: Alpine apk 模式,使用 Alpine 仓库的 Node.js + 两种版本均使用 **Alpine apk 模式** 构建: + - **V2**: 使用 Alpine `nodejs-current` 包 (v23.x),满足 OpenClaw >= 22.16.0 的要求 + - **V1**: 使用 Alpine `nodejs` LTS 包 (v22.x),兼容旧版 OpenClaw `openclaw-env setup` 会在 ARM64 musl 设备上自动从此处下载合适的版本。 diff --git a/scripts/build-node-musl.sh b/scripts/build-node-musl.sh index fe2656f..9e3fc3e 100755 --- a/scripts/build-node-musl.sh +++ b/scripts/build-node-musl.sh @@ -26,10 +26,19 @@ echo " Target version: v${NODE_VER}" echo " Build mode: ${BUILD_MODE}" # ── apk 模式: 使用 Alpine 仓库的 Node.js ── +# PKG_TYPE: lts (nodejs) 或 current (nodejs-current) build_apk() { echo "" echo "=== Building with Alpine apk mode ===" - apk add --no-cache nodejs npm xz icu-data-full patchelf + + # 根据请求的版本选择包 + if [ "${PKG_TYPE}" = "current" ]; then + echo "Using nodejs-current package for newer version" + apk add --no-cache nodejs-current npm xz icu-data-full patchelf + else + echo "Using nodejs (LTS) package" + apk add --no-cache nodejs npm xz icu-data-full patchelf + fi ACTUAL_VER=$(node --version | sed 's/^v//') echo "Alpine Node.js version: v${ACTUAL_VER} (requested: v${NODE_VER})"