Skip to content

Add support for openharmony-arm64 platform#6081

Merged
lukastaegert merged 2 commits intorollup:masterfrom
hqzing:support_openharmony
Aug 31, 2025
Merged

Add support for openharmony-arm64 platform#6081
lukastaegert merged 2 commits intorollup:masterfrom
hqzing:support_openharmony

Conversation

@hqzing
Copy link
Copy Markdown
Contributor

@hqzing hqzing commented Aug 22, 2025

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

Description

Thanks to the support for OpenHarmony in Node.js and napi-rs, we can easily make Rollup support this platform.

I referred to Rolldown(rolldown/rolldown#5258) to do this, and I have already verified it by setting up a private repository using Verdacio locally.

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rollup Ready Ready Preview Comment Aug 26, 2025 5:40am

@hqzing hqzing force-pushed the support_openharmony branch from 5bc6fda to cd50c76 Compare August 22, 2025 07:17
Copy link
Copy Markdown
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Nice! Before merging this, I want to merge #6078 though, which changes the build pipeline, probably on Monday. After that, you may want to check if you need to update this PR.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.79%. Comparing base (59c16b9) to head (41cdb44).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6081   +/-   ##
=======================================
  Coverage   98.79%   98.79%           
=======================================
  Files         271      271           
  Lines       10620    10620           
  Branches     2838     2838           
=======================================
  Hits        10492    10492           
  Misses         88       88           
  Partials       40       40           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hqzing
Copy link
Copy Markdown
Contributor Author

hqzing commented Aug 23, 2025

Got it, I'll wait and re-check the PR.

@hqzing
Copy link
Copy Markdown
Contributor Author

hqzing commented Aug 25, 2025

I have updated this PR after #6078 was merged. You can continue to review this PR now. @lukastaegert

Copy link
Copy Markdown
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@lukastaegert lukastaegert added this pull request to the merge queue Aug 31, 2025
Merged via the queue into rollup:master with commit 38a5c6d Aug 31, 2025
44 checks passed
@github-actions
Copy link
Copy Markdown

This PR has been released as part of rollup@4.50.0. You can test it via npm install rollup.

@hqzing
Copy link
Copy Markdown
Contributor Author

hqzing commented Sep 2, 2025

It works. @lukastaegert

rollup

@hqzing hqzing deleted the support_openharmony branch September 2, 2025 03:37
@yuanbaobaoo
Copy link
Copy Markdown

rollup

@hqzing

/storage/Users/currentUser/codes/test/node_modules/rollup/dist/native.js:83
                throw new Error(
                      ^

Error: Cannot find module @rollup/rollup-openharmony-arm64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (/storage/Users/currentUser/codes/test/node_modules/rollup/dist/native.js:83:9)
    at Object.<anonymous> (/storage/Users/currentUser/codes/test/node_modules/rollup/dist/native.js:92:76)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    ... 2 lines matching cause stack trace ...
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at cjsLoader (node:internal/modules/esm/translators:329:5)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:260:7) {
  [cause]: Error: Error loading shared library /storage/Users/currentUser/codes/test/node_modules/@rollup/rollup-openharmony-arm64/rollup.openharmony-arm64.node: Permission denied
      at Module._extensions..node (node:internal/modules/cjs/loader:1717:18)
      at Module.load (node:internal/modules/cjs/loader:1317:32)
      at Module._load (node:internal/modules/cjs/loader:1127:12)
      at TracingChannel.traceSync (node:diagnostics_channel:315:14)
      at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
      at Module.require (node:internal/modules/cjs/loader:1339:12)
      at require (node:internal/modules/helpers:126:16)
      at requireWithFriendlyError (/storage/Users/currentUser/codes/test/node_modules/rollup/dist/native.js:65:10)
      at Object.<anonymous> (/storage/Users/currentUser/codes/test/node_modules/rollup/dist/native.js:92:76)
      at Module._compile (node:internal/modules/cjs/loader:1546:14) {
    code: 'ERR_DLOPEN_FAILED'
  }
}

Thank you for your contribution. I have encountered an issue during use: in native. js, try executing const localName=`./rollup. ${packageBase}. node `; But in the HarmonyOS system, this cannot work. Considering system limitations, how should this place be handled appropriately?

@hqzing
Copy link
Copy Markdown
Contributor Author

hqzing commented Oct 18, 2025

@yuanbaobaoo

HarmonyOS is a special commercial distribution of OpenHarmony. Compared with the community edition of OpenHarmony, this distribution imposes many additional security restrictions. For example, when loading a dynamic library on HarmonyOS, the library must carry a valid code signature.

Your issue is most likely caused by rollup.openharmony-arm64.node lacking such a signature, so the system refuses to load it.

At the moment, however, I have no plan to add a dedicated signature for HarmonyOS. Vendors have not yet provided a mature toolchain or a complete signing workflow; I prefer to wait until they improve both the toolchain and the security mechanisms before tackling signature-related work.

In the meantime, you can try using the npm package ohos-signpost to work around the problem.

If you have further questions, feel free to email me directly.

@yuanbaobaoo
Copy link
Copy Markdown

@yuanbaobaoo

HarmonyOS is a special commercial distribution of OpenHarmony. Compared with the community edition of OpenHarmony, this distribution imposes many additional security restrictions. For example, when loading a dynamic library on HarmonyOS, the library must carry a valid code signature.

Your issue is most likely caused by rollup.openharmony-arm64.node lacking such a signature, so the system refuses to load it.

At the moment, however, I have no plan to add a dedicated signature for HarmonyOS. Vendors have not yet provided a mature toolchain or a complete signing workflow; I prefer to wait until they improve both the toolchain and the security mechanisms before tackling signature-related work.

In the meantime, you can try using the npm package ohos-signpost to work around the problem.

If you have further questions, feel free to email me directly.

ok,i will try the solution you provided first, thank you

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.

3 participants