-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node.js always builds as if cross-compiling #321847
Comments
reposting the notifications. I had filled that in after submitting this and I think that doesn't actually notify the mentioned people when editing. but sorry for the extra notification if it already had Notify maintainers @NickCao if you remember about these vars maintainers @cillianderoiste @cko @aduh95 |
I think this has been fixed by #322799. Closing for now, let me know if I missed something. |
I don’t think this was fixed by #322799 since it still sets |
Fixed in #327653. |
Describe the bug
I tried building Node.js using ccacheStdenv, and it was faster than with normal stdenv. Here's my theory of why that is.
Node.js always builds as if cross-compiling, producing various 'host' and 'target' files even when building for the same architecture and OS. Everything still seems to work, but there's quite some wasted time in the build process compiling several things twice exactly the same.
https://github.com/nodejs/gyp-next/blob/main/docs/UserDocumentation.md#cross-compiling
https://github.com/nodejs/node/blob/v22.2.0/tools/gyp/pylib/gyp/common.py#L695-L696
Docs say it cross compiles if "one of the toolchain-related variables (like
CC_host
orCC_target
) is set."nixpkgs/pkgs/development/web/nodejs/nodejs.nix
Lines 62 to 63 in 218df71
Nixpkgs does set these.
Steps To Reproduce
Steps to reproduce the behavior:
https://cache.nixos.org/log/ix3b9lqmh4iq26kwx3jnvb2kn076961g-nodejs-22.2.0.drv
On this build from Hydra, 5414 lines are about
.host
stuff and 5862 lines are about.target
(30 lines with both).Here's a sample of two lines from the log:
(lines are long, expand this to view them)
They compile the exact same files with the exact same flags, with
g++
andc++
referring to the exact same compiler, and I would guess those .o.d.raw files are the same too.Expected behavior
For comparison, here's Node.js's own CI build, with very few lines about
.host
. (I think you need to be logged in on GitHub to open this.)https://github.com/nodejs/node/actions/runs/9091211063/job/24985365999
The sample lines from above about builtins-regexp-gen.cc only occurs once.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Notify maintainers
@NickCao if you remember about these vars
maintainers @cillianderoiste @cko @aduh95
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.I don't have stuff set up for nix-info to run successfully, but it's Nix 2.18.2, nixos-24.05
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: