Summary of cross build NAPI-RS packages
NAPI-RS is aiming to provide a complete solution for building Node.js native addons, especially for enterprise users.
For the open-source projects on GitHub, NAPI-RS provided out-of-box CI/CD support for building and publishing prebuilt binaries for Windows, Linux macOS and FreeBSD with the release of NAPI-RS v2. There are also many users who are using self-hosted CI and want to build native addons for multiple platforms on a single system (mostly Linux). NAPI-RS v2 provides a solution for this use case.
There is a demo project (opens in a new tab) for those users who want to build multi-platform addons on a single system. The CI of this project builds NAPI-RS packages on a GitHub Linux CI, and produces addons for the following platform:
- Windows x64
- Windows x86
- Windows arm64
- macOS x64
- macOS arm64
- Linux x64 gnu (
- Linux x64 musl
- Linux arm64 gnu (
- Linux arm64 musl
- Linux armv7 gnueabihf
- Android arm64
- Android armv7
If you are building NAPI-RS packages with self-hosted Linux CI, you should install the following toolchain to build the addons for the above platforms:
rustupand your target rust std. eg:
rustup target add aarch64-apple-darwin.
llvm(opens in a new tab). The latest qualification version is recommended.
cargo-xwin(opens in a new tab) if you want to build for Windows on the non Windows system.
cargo install cargo-xwin.
- Linux x64/arm64 both gnu and musl ✅
- macOS x64/arm64 ✅
- Windows is blocked by: https://github.com/ziglang/zig/issues/10881 (opens in a new tab)
Integrating and properly configuring cross-platform compilation toolchain in the open source community can be very tedious and labor-intensive. Understanding these compilation parameters and resolving potential bugs can be very time-consuming and difficult to test.
Special thanks for our team member @messense (opens in a new tab) who has been working on
cargo-xwin which is enabled us to build Windows native addons on non-Windows systems.
If you are using NAPI-RS in your company, please consider sponsoring our team to support the development of NAPI-RS. We will be very grateful for your support.