From c2e6158ce7bf8082b6bb5eb50cb29ddad9796bd1 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 3 Sep 2026 17:17:40 +0200 Subject: [PATCH 1/2] build: Add nodejs-wheel-binaries riscv64 wheel build nodejs-wheel-binaries builds Node.js itself from source via CMake ExternalProject_Add (upstream's own configure/make, same on every platform) rather than vendoring a prebuilt binary, and Node 24.19.0's configure.py/V8 both support riscv64 natively. --- .../workflows/build-nodejs-wheel-binaries.yml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/build-nodejs-wheel-binaries.yml diff --git a/.github/workflows/build-nodejs-wheel-binaries.yml b/.github/workflows/build-nodejs-wheel-binaries.yml new file mode 100644 index 000000000..8058e9a57 --- /dev/null +++ b/.github/workflows/build-nodejs-wheel-binaries.yml @@ -0,0 +1,68 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT + +# This workflow is based on: https://github.com/njzjz/nodejs-wheel/blob/master/.github/workflows/build_wheel.yml +name: Build nodejs-wheel-binaries wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'nodejs-wheel-binaries version to build (git tag without leading v, e.g. 24.19.0)' + required: true + default: '24.19.0' + pull_request: + paths: + - '.github/workflows/build-nodejs-wheel-binaries.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '24.19.0' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + NODEJS_WHEEL_BINARIES_VERSION: ${{ inputs.version || '24.19.0' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build nodejs-wheel-binaries ${{ inputs.version || '24.19.0' }} manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 1440 # 24h — full Node.js (V8 + ICU) compile from source + steps: + - name: Checkout nodejs-wheel v${{ env.NODEJS_WHEEL_BINARIES_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: njzjz/nodejs-wheel + ref: v${{ env.NODEJS_WHEEL_BINARIES_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: cp312-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: nodejs-wheel-binaries-${{ env.NODEJS_WHEEL_BINARIES_VERSION }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish nodejs-wheel-binaries ${{ inputs.version || '24.19.0' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: nodejs-wheel-binaries-${{ inputs.version || '24.19.0' }}-*-manylinux_riscv64 From b2d56639ad74e7f5d1eb9cdb9e5619beac4bad66 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 3 Sep 2026 18:35:24 +0200 Subject: [PATCH 2/2] build: patch riscv64 configure to pass --openssl-no-asm The riscv64 build job failed 30 minutes in: gcc rejected the x86-only -m64 flag while compiling OpenSSL. Node's deps/openssl/openssl_asm.gypi has no riscv64 branch, so its catch-all fallback wrongly includes the linux-x86_64 asm config. --openssl-no-asm selects the no-asm config, which does have a riscv64 branch. --- .../workflows/build-nodejs-wheel-binaries.yml | 9 ++++ ...s-openssl-no-asm-to-Node-s-configure.patch | 50 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 patches/nodejs-wheel-binaries/24.19.0/0001-riscv64-pass-openssl-no-asm-to-Node-s-configure.patch diff --git a/.github/workflows/build-nodejs-wheel-binaries.yml b/.github/workflows/build-nodejs-wheel-binaries.yml index 8058e9a57..43222101c 100644 --- a/.github/workflows/build-nodejs-wheel-binaries.yml +++ b/.github/workflows/build-nodejs-wheel-binaries.yml @@ -43,6 +43,15 @@ jobs: ref: v${{ env.NODEJS_WHEEL_BINARIES_VERSION }} persist-credentials: false + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Pass --openssl-no-asm to Node's configure on riscv64 + run: git apply python-wheels/patches/nodejs-wheel-binaries/${{ env.NODEJS_WHEEL_BINARIES_VERSION }}/00*.patch + - name: Build wheels uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 with: diff --git a/patches/nodejs-wheel-binaries/24.19.0/0001-riscv64-pass-openssl-no-asm-to-Node-s-configure.patch b/patches/nodejs-wheel-binaries/24.19.0/0001-riscv64-pass-openssl-no-asm-to-Node-s-configure.patch new file mode 100644 index 000000000..97105ece0 --- /dev/null +++ b/patches/nodejs-wheel-binaries/24.19.0/0001-riscv64-pass-openssl-no-asm-to-Node-s-configure.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Thu, 3 Sep 2026 18:34:50 +0200 +Subject: [PATCH] riscv64: pass --openssl-no-asm to Node's configure + +Upstream-Status: To upstream [not yet submitted; riscv64 is not part of njzjz/nodejs-wheel's own CI matrix, so nothing depends on it, but the fix is small and generally applicable] + +Node's vendored deps/openssl/openssl_asm.gypi has no riscv64 branch. Its +catch-all "other architectures don't use assembly" clause still includes +config/archs/linux-x86_64/asm/openssl.gypi, whose cflags carry the x86-only +-m64 flag, so gcc fails with "unrecognized command-line option '-m64'" +partway through the OpenSSL build. --openssl-no-asm makes Node's own +openssl.gyp select openssl_no_asm.gypi instead, which does have a riscv64 +branch (config/archs/linux64-riscv64/no-asm) with no -m64 in its cflags. +Verified by running node's configure under linux/riscv64 QEMU with and +without the flag: only the unpatched command line's generated +openssl.target.mk contains -m64. + +Signed-off-by: Ludovic Henry +--- + CMakeLists.txt | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2cb01bb..73124ae 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,12 +6,21 @@ include(ProcessorCount) + ProcessorCount(N) + include(ExternalProject) + if (UNIX) ++ set(_node_configure_args --prefix=${SKBUILD_PLATLIB_DIR}/nodejs_wheel) ++ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") ++ # deps/openssl/openssl_asm.gypi has no riscv64 branch, so its catch-all ++ # "other architectures don't use assembly" case still includes ++ # linux-x86_64's asm config, which fails with "unrecognized command-line ++ # option -m64". --openssl-no-asm selects openssl_no_asm.gypi instead, ++ # which does have a riscv64 branch. ++ list(APPEND _node_configure_args --openssl-no-asm) ++ endif() + ExternalProject_Add(nodejs + URL https://github.com/nodejs/node/archive/refs/tags/v${CMAKE_PROJECT_VERSION}.tar.gz + CONFIGURE_COMMAND echo >> /deps/cares/config/linux/ares_config.h + COMMAND echo \#undef HAVE_SYS_RANDOM_H >> /deps/cares/config/linux/ares_config.h + COMMAND echo \#undef HAVE_GETRANDOM >> /deps/cares/config/linux/ares_config.h +- COMMAND /configure --prefix=${SKBUILD_PLATLIB_DIR}/nodejs_wheel ++ COMMAND /configure ${_node_configure_args} + BUILD_IN_SOURCE 1 + BUILD_COMMAND make -j${N} + INSTALL_COMMAND make install