-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
nodejs doesn't cross-compile to non-executable hostPlatform #142651
Comments
Adding additional context to this: I've successfully been able to build by using an i686 build platform and the following overlay:
I suspect this isn't quite the right fix though for a number of reasons. I also wasn't able to find a way to cross-compile from x86-64 to armv6l. It seems one needs a buildPlatform side toolchain with 32-bit support, which would suggest a multiStdenv for the buildPlatform but not the hostPlatform, and I'm not sure how to accomplish that. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/cross-compile-nodejs-broken-python-interpreter/18131/2 |
I am also running into this (the linked Discourse thread is mine). It looks like buildroot fixes this problem by compiling the build tools for the build platform first, and then using those binaries when compiling for the target platform (https://github.com/buildroot/buildroot/blob/master/package/nodejs/nodejs.mk#L105) Do you have time to look at this, @goibhniu @gilligan @cko @marsam? I am willing to give this a shot but I'll need some pointers to get started... |
The workaround I found is to replace |
Describe the bug
Cross-compiling nodejs for a hostPlatform whose binaries can't be executed on the buildPlatform fails.
Steps To Reproduce
Steps to reproduce the behavior:
nix-build '<nixpkgs>' -A pkgsCross.raspberryPi.nodejs_latest
Also fails with
nodejs-slim
,nodejs-12_x
,nodejs-14_x
, etc.Expected behavior
The package to be built successfully.
Additional context
The problem seems to be that binaries, notably
out/Release/bytecode_builtins_list_generator
, need to be built with the build environment toolchain, not the host toolchain. Node's build process allows specification of the location of the necessary build compilers via environment variables (AR_host
,CXX_host
,CC_host
,LINK_host
,CXXFLAGS_host
andLDFLAGS_host
are mentioned in one of the links below).nodejs/node#32717 seems relevant, as does nodejs/node#24317. The latter mentions buildroot getting this right, here's what they do.
Notify maintainers
@goibhniu @gilligan @cko @marsam
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information:
The text was updated successfully, but these errors were encountered: