Skip to content

feat: support riscv64 targets - #14447

Merged
chenjiahan merged 9 commits into
mainfrom
feat/riscv64
Jun 24, 2026
Merged

chenjiahan merged 9 commits into
mainfrom
feat/riscv64

Conversation

@swwind

@swwind swwind commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for publishing Node.js bindings for the Linux RISC-V 64-bit architecture.

  • riscv64gc-unknown-linux-gnu (Linux RISC-V 64-bit, glibc-based)
  • riscv64gc-unknown-linux-musl (Linux RISC-V 64-bit, musl-based)

Related links

fixes #11656.

image

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

Latest commit: ff0b79b
Status: ✅  Deploy successful!
Preview URL: https://029c2e04.rspack-v2.pages.dev
Branch Preview URL: https://feat-riscv64.rspack-v2.pages.dev

View logs

@swwind swwind changed the title feat(binding): support riscv64gc-unknown-linux-gnu and musl targets feat: support riscv64 Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 22fb72f to fix(split-chunks): align max size grouping with webpack (#14481) by AsyncIter

🙈 Size remains the same at 67.91MB

@codspeed

codspeed Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 41 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing feat/riscv64 (22fb72f) with main (062df8d)2

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (08da401) during the generation of this report, so 062df8d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@github-actions

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 551.7 KB - -
react-10k 5.6 MB 1.3 MB - -
react-1k 822.8 KB 218.3 KB - -
ui-components 4.9 MB 1.4 MB - -
react-5k 2.7 MB 669.1 KB - -
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 1.7 MB - -
🗜️ Gzip Size 551.7 KB - -
📄 JavaScript 1.7 MB - -
🎨 CSS 0 B - -
🌐 HTML 289.0 B - -
📁 Other Assets 0 B - -

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.6 MB - -
🗜️ Gzip Size 1.3 MB - -
📄 JavaScript 5.6 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 822.8 KB - -
🗜️ Gzip Size 218.3 KB - -
📄 JavaScript 822.4 KB - -
🎨 CSS 0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 4.9 MB - -
🗜️ Gzip Size 1.4 MB - -
📄 JavaScript 4.8 MB - -
🎨 CSS 111.9 KB - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
🗜️ Gzip Size 669.1 KB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@swwind
swwind marked this pull request as ready for review June 17, 2026 07:27
@swwind
swwind requested a review from stormslowly as a code owner June 17, 2026 07:27
@swwind

swwind commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Adding a Risc-V runner for running pnpm run test:ci may not be feasible because many upstream napi packages in devDependecies do not provide riscv64 binaries.

Additionally, the linux-riscv64-gnu version has been tested locally with QEMU and can be used to build template rsbuild projects.

@stormslowly

stormslowly commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

@swwind try add a test job for risc by QEMU or some other ways. There should be some guardians if we are going to publish risc arch bindings.. rsic is experimental in node.js, it seems that we ensure the binding's ok is enough.

Beside, trigger a canary release with risc bindings, to evaluate the effect on the publish process.

@swwind

swwind commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@stormslowly canary results can be found here. It takes 11m9s to build -gnu one and 15m23s to build -musl one.

@chenjiahan chenjiahan changed the title feat: support riscv64 feat: support riscv64 targets Jun 22, 2026
@chenjiahan
chenjiahan merged commit b258c60 into main Jun 24, 2026
38 checks passed
@chenjiahan
chenjiahan deleted the feat/riscv64 branch June 24, 2026 09:31
felixonmars added a commit to felixonmars/archriscv-packages that referenced this pull request Sep 10, 2026
Set CHROMEDRIVER_SKIP_DOWNLOAD=true to avoid the bootstrap failure:
"No official Chromedriver binary is available for RISC-V 64-bit".
ChromeDriver is a development dependency used for browser tests,
which the PKGBUILD does not run.

Enable --install.ignore-platform in the project's .yarnrc so Yarn
Classic installs the locked WASM fallback bindings. Rspack 2.0.8 has
no native riscv64 package, and Yarn skips its fallback because it
declares cpu: ["wasm32"], leaving @osd/monaco bootstrap failing with
"Cannot find native binding". Keep engine checks enabled.

Update @rspack/core and @rspack/cli to 2.1.0, which ships native riscv64
bindings. With the WASM package installed, 2.0.8 still fails on monferno:
"WebAssembly.Module(): Wasm SIMD unsupported @+1235". The loader hides
this error behind the native-binding diagnostic. Use the native binding
to avoid Rspack's WASM SIMD requirement.

Use jq to update the two dependency versions while preserving Yarn's
workspaces object and nohoist rules. npm pkg set rejects that format
with EWORKSPACESINVALID: "workspaces should be an array of strings."

Keep the Yarn platform override and Sv39 blacklist for the remaining
WASM fallbacks, including Tailwind oxide and @rspack/resolver, which
still require a larger address space.

Upstream: web-infra-dev/rspack#14447

Set ENABLE_V8_FUNCTIONS=false for LMDB 2.8.5, which builds from source
on riscv64. Its bundled V8 header declares the old three-argument
CFunctionInfo constructor, but Node 22 requires a fourth argument.
Bootstrap fails loading lmdb.node with:
"undefined symbol: _ZN2v813CFunctionInfoC2ERKNS_9CTypeInfoEjPS2_".

Use LMDB's supported Node-API implementation, as upstream does for its
portable prebuilt binaries. This retains database functionality without
the incompatible optional V8 acceleration or a dependency version bump.

https://github.com/kriszyp/lmdb-js/blob/189f52bf720f1bda436dc5162e88af4686c6218c/package.json

Add opensearch-dashboards to the QEMU-user blacklist. On magby, LMDB
loads but opening the compiler cache fails with "Operation not
supported". mdb_env_setup_locks() initializes process-shared robust
mutexes; QEMU-user returns ENOSYS for the robust-list syscalls, so glibc
returns ENOTSUP from pthread_mutex_init(). Standalone LMDB is already
blacklisted for the same failure (a75042c). Keep robust locking and
the existing Sv39 exclusion intact.

Work around the native Rspack SIGSEGV while bootstrapping
@osd/ui-shared-deps on abomasnow. Its prebuilt riscv64 binding contains
mimalloc compiled with GCC 11.4, which emits LR.aq/SC.aq for acquire-
release compare-exchange without the required release ordering. A freed
block can become visible to another CPU before its next-pointer is
initialized, corrupting mimalloc's cross-thread free list.

GDB stops in that list traversal at binding offset 0x229786a. Restoring
release ordering to mimalloc's SC instructions in process memory makes
the same bundle complete; an unmodified control run crashes again.

Pin both Yarn build commands and their child threads to the first CPU
in the allowed affinity set. The original binary completes the bundle
with this restriction, avoiding cross-CPU ordering failures without
rebuilding or modifying the binding. This sacrifices build parallelism
until the prebuilt binding is rebuilt with a corrected C toolchain.

The WASM binding is not a usable alternative on this builder: explicitly
loading 2.1.0 still fails with "Wasm SIMD unsupported @+1373" because
Node 22 requires RVV for WASM SIMD, which the P550 lacks.

GCC fix: gcc-mirror/gcc@d199d2e

Resolve lightningcss to npm:[email protected]. Tailwind 4.2.4
requires Lightning CSS 1.32.0, which has no native riscv64 binding.
Plugin CSS compilation fails with:
"Cannot find module '../lightningcss.linux-riscv64-gnu.node'".

Use the published WASM build at the same version, following oxyromon's
override. Its Node entry point provides the synchronous transform API
and Features constants used by Tailwind, without requiring WASM SIMD.
Add the Yarn resolution through the existing jq manifest edit.
felixonmars added a commit to felixonmars/archriscv-packages that referenced this pull request Sep 10, 2026
Set CHROMEDRIVER_SKIP_DOWNLOAD=true to avoid the bootstrap failure:
"No official Chromedriver binary is available for RISC-V 64-bit".
ChromeDriver is a development dependency used for browser tests,
which the PKGBUILD does not run.

Enable --install.ignore-platform in the project's .yarnrc so Yarn
Classic installs the locked WASM fallback bindings. Rspack 2.0.8 has
no native riscv64 package, and Yarn skips its fallback because it
declares cpu: ["wasm32"], leaving @osd/monaco bootstrap failing with
"Cannot find native binding". Keep engine checks enabled.

Update @rspack/core and @rspack/cli to 2.1.0, which ships native riscv64
bindings. With the WASM package installed, 2.0.8 still fails on monferno:
"WebAssembly.Module(): Wasm SIMD unsupported @+1235". The loader hides
this error behind the native-binding diagnostic. Use the native binding
to avoid Rspack's WASM SIMD requirement.

Use jq to update the two dependency versions while preserving Yarn's
workspaces object and nohoist rules. npm pkg set rejects that format
with EWORKSPACESINVALID: "workspaces should be an array of strings."

Keep the Yarn platform override and Sv39 blacklist for the remaining
WASM fallbacks, including Tailwind oxide and @rspack/resolver, which
still require a larger address space.

Upstream: web-infra-dev/rspack#14447

Set ENABLE_V8_FUNCTIONS=false for LMDB 2.8.5, which builds from source
on riscv64. Its bundled V8 header declares the old three-argument
CFunctionInfo constructor, but Node 22 requires a fourth argument.
Bootstrap fails loading lmdb.node with:
"undefined symbol: _ZN2v813CFunctionInfoC2ERKNS_9CTypeInfoEjPS2_".

Use LMDB's supported Node-API implementation, as upstream does for its
portable prebuilt binaries. This retains database functionality without
the incompatible optional V8 acceleration or a dependency version bump.

https://github.com/kriszyp/lmdb-js/blob/189f52bf720f1bda436dc5162e88af4686c6218c/package.json

Add opensearch-dashboards to the QEMU-user blacklist. On magby, LMDB
loads but opening the compiler cache fails with "Operation not
supported". mdb_env_setup_locks() initializes process-shared robust
mutexes; QEMU-user returns ENOSYS for the robust-list syscalls, so glibc
returns ENOTSUP from pthread_mutex_init(). Standalone LMDB is already
blacklisted for the same failure (a75042c). Keep robust locking and
the existing Sv39 exclusion intact.

Work around the native Rspack SIGSEGV while bootstrapping
@osd/ui-shared-deps on abomasnow. Its prebuilt riscv64 binding contains
mimalloc compiled with GCC 11.4, which emits LR.aq/SC.aq for acquire-
release compare-exchange without the required release ordering. A freed
block can become visible to another CPU before its next-pointer is
initialized, corrupting mimalloc's cross-thread free list.

GDB stops in that list traversal at binding offset 0x229786a. Restoring
release ordering to mimalloc's SC instructions in process memory makes
the same bundle complete; an unmodified control run crashes again.

Pin both Yarn build commands and their child threads to the first CPU
in the allowed affinity set. The original binary completes the bundle
with this restriction, avoiding cross-CPU ordering failures without
rebuilding or modifying the binding. This sacrifices build parallelism
until the prebuilt binding is rebuilt with a corrected C toolchain.

The WASM binding is not a usable alternative on this builder: explicitly
loading 2.1.0 still fails with "Wasm SIMD unsupported @+1373" because
Node 22 requires RVV for WASM SIMD, which the P550 lacks.

GCC fix: gcc-mirror/gcc@d199d2e

Resolve lightningcss to npm:[email protected]. Tailwind 4.2.4
requires Lightning CSS 1.32.0, which has no native riscv64 binding.
Plugin CSS compilation fails with:
"Cannot find module '../lightningcss.linux-riscv64-gnu.node'".

Use the published WASM build at the same version, following oxyromon's
override. Its Node entry point provides the synchronous transform API
and Features constants used by Tailwind, without requiring WASM SIMD.
Add the Yarn resolution through the existing jq manifest edit.
felixonmars added a commit to felixonmars/archriscv-packages that referenced this pull request Sep 27, 2026
Bypass the Lerna/Nx bootstrap on riscv64: its WASM fallback lacks FileLock. Install the CLI and internal test package directly, retaining the upstream build and test suite. Use Rspack 2.1.0 for both packages because 2.0.5 lacks a native riscv64 binding. Keep parallel Jest tests using libzip WASM off Sv39 workers.

Use complete diagnostic messages instead of 32-bit hashes for deduplication. MatchClass1 fails with "Expected 7 errors, got 8" after emitting the same [411:14] "float | int" diagnostic twice. Avoid the integer hashing path without changing the expected error count, and cover repeated insertion and distinct messages with colliding hashes. No matching Pyright fix was found; the RISC-V Maglev Word32 bug still present in Node 26.9.0 is a suspected trigger, not a confirmed diagnosis.

Increase the LSP test-signal timeout from 10 to 60 seconds for "Timed out waiting for signal didopendocument". Upstream #11521 reports the same failure under parallel suite load. Preserve the complete configured suite and add no skips.

https://archriscv.felixc.at/.status/logs/pyright/pyright-1.1.412-1.log
nrwl/nx#20914
web-infra-dev/rspack#14447
microsoft/pyright#11521
v8/v8@3b5f516
felixonmars added a commit to felixonmars/archriscv-packages that referenced this pull request Sep 27, 2026
Bypass the Lerna/Nx bootstrap on riscv64: its WASM fallback lacks FileLock. Install the CLI and internal test package directly, retaining the upstream build and test suite. Use Rspack 2.1.0 for both packages because 2.0.5 lacks a native riscv64 binding. Keep parallel Jest tests using libzip WASM off Sv39 workers.

Use complete diagnostic messages instead of 32-bit hashes for deduplication. MatchClass1 fails with "Expected 7 errors, got 8" after emitting the same [411:14] "float | int" diagnostic twice. Avoid the integer hashing path without changing the expected error count, and cover repeated insertion and distinct messages with colliding hashes. No matching Pyright fix was found; the RISC-V Maglev Word32 bug still present in Node 26.9.0 is a suspected trigger, not a confirmed diagnosis.

Increase the LSP test-signal timeout from 10 to 60 seconds for "Timed out waiting for signal didopendocument". Upstream #11521 reports the same failure under parallel suite load. Preserve the complete configured suite and add no skips.

https://archriscv.felixc.at/.status/logs/pyright/pyright-1.1.412-1.log
nrwl/nx#20914
web-infra-dev/rspack#14447
microsoft/pyright#11521
v8/v8@3b5f516
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.

[Bug]: @rspack/binding-linux-riscv64-musl npm module missing

3 participants