You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build failure: nodejs cross compiling for raspberry pi armv6l #319036
/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
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 nodejs/node#44357.
W.r.t. your comment #327778 (comment) (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
Activity
jue89 commentedon Jun 13, 2024
I hacked around this problem:
This actually seems to work!
But now I run into a new Problem:
Has anyone an idea how to fix this?
tie commentedon Jul 15, 2024
I think PR #220204 addresses this issue.
tie commentedon Jul 17, 2024
FWIW, for some reason
raspberryPiis defined asgcc.fpu = "vfp"instead ofvfpv2in 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 nodejs/node#44357).
I’m not familiar with Raspberry Pi hardware, but if it supports
vfpv2, I think it makes sense to update the platform preset:nixpkgs/lib/systems/platforms.nix
Line 205 in 43d306e
jue89 commentedon Jul 18, 2024
#327778 (comment)
tie commentedon Jul 18, 2024
I experimented with this a bit yesterday and I think setting
gcc.arch = "armv6kz"alone should be enough for Node.js (though I also hadgcc.fpu = "vfpv2"set so I can’t say that with 100% confidence). Note that Node.js needsyieldinstructions that are not available forarmv6and require at leastarmv6k(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 nodejs/node#44357.W.r.t. your comment #327778 (comment) (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.
lib/systems: set gcc.arch = "armv6kz", gcc.fpu = "vfpv2" for raspberryPi
jue89 commentedon Jul 18, 2024
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?) ;-)
tie commentedon Jul 18, 2024
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
(at the root of Nixpkgs repository checkout with #327653 applied)
jue89 commentedon Jul 18, 2024
Ah and it'll use qemu for compiling nodejs?
Nice! Thank you a lot :)
tie commentedon Jul 18, 2024
Yes,
stdenv.hostPlatform.emulator buildPackagesto be exact (that happens to be user mode QEMU when building Linux → Linux).tie commentedon Aug 13, 2024
Should be fixed in #327653, but I’ll keep the issue open until we get a decision on #327778.
lib/systems: set gcc.arch = "armv6kz", gcc.fpu = "vfpv2" for raspberryPi
lib/systems: set gcc.arch = "armv6kz", gcc.fpu = "vfpv2" for raspberryPi
jue89 commentedon Sep 19, 2024
I'd say this issue has been solved! Thank you all for your effort to fix the build issue :-)