Open jue89 opened 2 months ago
I hacked around this problem:
preBuild = lib.optionalString isCross ''
mkdir deps/v8/gnu
touch deps/v8/gnu/stubs-32.h
'';
This actually seems to work!
But now I run into a new Problem:
/nix/store/bgcaxhhxswzvmxjbbgvvaximm5hwghz1-binutils-2.41/bin/ld: /build/node-v20.12.2/out/Release/obj.host/deps/simdutf/libsimdutf.a: error adding symbols: archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
Has anyone an idea how to fix this?
I think PR #220204 addresses this issue.
FWIW, for some reason raspberryPi
is defined as gcc.fpu = "vfp"
instead of vfpv2
in Nixpkgs.
https://wiki.debian.org/RaspberryPi#:~:text=The%20CPU%20in%20the%20Raspberry%20Pi,VFP2%29
I don’t think Node.js supports (armv6, vfp) combination (see https://github.com/nodejs/node/issues/44357).
I’m not familiar with Raspberry Pi hardware, but if it supports vfpv2
, I think it makes sense to update the platform preset:
https://github.com/NixOS/nixpkgs/blob/43d306e7db4f7e8914de693a2d7c223f38c0a8f7/lib/systems/platforms.nix#L205
I experimented with this a bit yesterday and I think setting gcc.arch = "armv6kz"
alone should be enough for Node.js (though I also had gcc.fpu = "vfpv2"
set so I can’t say that with 100% confidence). Note that Node.js needs yield
instructions that are not available for armv6
and require at least armv6k
(see https://redd.it/144sh53). According to Raspberry Pi specifications on the Wikipedia article, it is ARMv6Z (K implied as far as I understand). See also https://reviews.llvm.org/D14568 and https://github.com/nodejs/node/issues/44357.
W.r.t. your comment https://github.com/NixOS/nixpkgs/pull/327778#issuecomment-2236365814 (i.e. building Node.js for pkgsCross.raspberryPi with updated gcc arch/fpu), use #327653. The current Node.js derivation always cross-compiles, but that doesn’t work well for platforms with different bitness (e.g. AArch64 to AArch32). The PR in question makes it so that we don’t cross-compile and instead use an emulator when we need to run a few tools built for the host platform.
Sry - I'm not an expert ... so building directly for the RPi's architecture using qemu / binfmt should create a working binary, right? I'll give this a try but I'll take some hours (or maybe days?) ;-)
It should take a few hours or so on a modern multi-core computer (though the PR is targeting staging and there is a bit of bottlenecking in the bootstrap process). E.g. something like
let
system = builtins.currentSystem;
lib = import ./lib;
nixpkgsFun = import ./.;
pkgs = nixpkgsFun {
localSystem = { inherit system; };
crossSystem = lib.systems.examples.raspberryPi // {
gcc = {
arch = "armv6kz";
fpu = "vfpv2";
};
};
};
in
pkgs.nodejs_22
(at the root of Nixpkgs repository checkout with #327653 applied)
Ah and it'll use qemu for compiling nodejs?
Nice! Thank you a lot :)
Ah and it'll use qemu for compiling nodejs?
Yes, stdenv.hostPlatform.emulator buildPackages
to be exact (that happens to be user mode QEMU when building Linux → Linux).
Should be fixed in #327653, but I’ll keep the issue open until we get a decision on #327778.
Steps To Reproduce
Steps to reproduce the behavior on current master:
Build log
Additional context
Notify maintainers
@cillianderoiste @cko @aduh95
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.