Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/build-nodejs-wheel-binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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: 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:
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
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 <git@ludovic.dev>
---
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 >> <SOURCE_DIR>/deps/cares/config/linux/ares_config.h
COMMAND echo \#undef HAVE_SYS_RANDOM_H >> <SOURCE_DIR>/deps/cares/config/linux/ares_config.h
COMMAND echo \#undef HAVE_GETRANDOM >> <SOURCE_DIR>/deps/cares/config/linux/ares_config.h
- COMMAND <SOURCE_DIR>/configure --prefix=${SKBUILD_PLATLIB_DIR}/nodejs_wheel
+ COMMAND <SOURCE_DIR>/configure ${_node_configure_args}
BUILD_IN_SOURCE 1
BUILD_COMMAND make -j${N}
INSTALL_COMMAND make install
Loading