Replies: 10 comments 1 reply
I would be interested to see if:
|
|
Thank you for the quick and encouraging response! These 4 points are extremely helpful and define a clear success criteria for the PoC. I will set up a local testing pipeline to evaluate
I’ll work on running these initial tests and report back here with the preliminary benchmark results and any findings! |
Build Condition
GCC Build
Zig Build
Notes & Issues with zig cc / zig c++
What's Next
Let me know if anyone has specific flags or setups they'd like tested! |
|
In the Zig build process, the build command used previously relied on the local gcc for the |
|
Hi there, This is a very interesting proposal. Using Here is some context regarding how this interacts with Node.js's build system and potential challenges to keep in mind for a PoC: 1. Key Technical Considerations & Potential Blockers
2. Suggested Path Forward for a PoCTo test feasibility, running a PoC cross-compile for an architecture like An example invocation pattern to test in a PoC: export CC="zig cc -target aarch64-linux-gnu"
export CXX="zig c++ -target aarch64-linux-gnu"
export CC_host="zig cc -target x86_64-linux-gnu"
export CXX_host="zig c++ -target x86_64-linux-gnu"
./configure \
--dest-cpu=arm64 \
--dest-os=linux \
--cross-compiling
make -j$(nproc)Comparing the resulting binary size, symbol exports ( Hope this provides useful context for initiating the discussion and PoC! If this response provides helpful insights or a solid framework for your proposal, please consider marking it as the accepted as I need this a lot :) |
Cross CompileBased on the advice, I used the following command to build for ARM64, and the build was successful. To see if it actually works, I ran a quick test using QEMU, and the results are as follows. Based on the above, it may be possible to easily cross-compile Node.js using zig as well. |
|
After building for the host environment and running |
|
I also ran all the other suite tests. The results were as follows:
|
Dependencies on Shared LibrariesBinary SizeBefore Running
|
|
Regarding the SEA issue, our investigation revealed that the problem lies within postject itself. It previously didn't handle non-default linker scenarios (such as LLD), as the tests and parsing logic were written under the strong assumption of a specific linker (ld). I have submitted a pull request (#109) to fix this issue. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
I would like to initiate a discussion around exploring and evaluating
zig cc/zig c++as an alternative/supplementary C/C++ cross-compiler toolchain for Node.js builds.Context & Motivation
Cross-compiling Node.js across various architectures (e.g., ARM64, RISC-V, x64) currently relies on managing complex platform-specific C/C++ toolchain matrices (GCC/Clang setups).
Since Zig ships with an embedded, hermetic Clang toolchain,
zig cccan act as a drop-in C/C++ compiler for almost any target without needing separate cross-compilation toolchains installed on the host machine.Potential Benefits
zig ccprovides out-of-the-box cross-compilation support for many target triples, potentially simplifying Node.js build infrastructure.Proposed Next Steps / Discussion Points
zig ccin the past? If so, were there any specific blockers (e.g., flags compatibility, V8 build constraints, libuv issues)?zig ccbuild results against the existing GCC/Clang pipeline for target platforms?I’d love to hear your thoughts and any historical context from the build team!
All reactions