nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
105.33k stars 28.54k forks source link

riscv64 build failure in 22.0.0 #52678

Open q66 opened 2 months ago

q66 commented 2 months ago

Version

22.0.0

Platform

Chimera Linux riscv64

Subsystem

v8

What steps will reproduce the bug?

compile

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

it compiles

What do you see instead?

[1824/1901] LINK mksnapshot
FAILED: mksnapshot 
clang++ -Wl,-z,pack-relative-relocs -fno-omit-frame-pointer -pthread -rdynamic -o mksnapshot -Wl,--start-group obj/deps/v8/src/snapshot/embedded/mksnapshot.embedded-empty.o obj/deps/v8/src/snapshot/embedded/mksnapshot.embedded-file-writer.o obj/deps/v8/src/snapshot/embedded/mksnapshot.platform-embedded-file-writer-aix.o obj/deps/v8/src/snapshot/embedded/mksnapshot.platform-embedded-file-writer-base.o obj/deps/v8/src/snapshot/embedded/mksnapshot.platform-embedded-file-writer-generic.o obj/deps/v8/src/snapshot/embedded/mksnapshot.platform-embedded-file-writer-mac.o obj/deps/v8/src/snapshot/embedded/mksnapshot.platform-embedded-file-writer-win.o obj/deps/v8/src/snapshot/mksnapshot.mksnapshot.o obj/deps/v8/src/snapshot/mksnapshot.snapshot-empty.o obj/deps/v8/src/snapshot/mksnapshot.static-roots-gen.o obj/tools/v8_gypfiles/libv8_base_without_compiler.a obj/tools/v8_gypfiles/libv8_init.a obj/tools/v8_gypfiles/libv8_libbase.a obj/tools/v8_gypfiles/libv8_libplatform.a obj/tools/v8_gypfiles/libv8_turboshaft.a obj/tools/v8_gypfiles/libv8_abseil.a obj/tools/v8_gypfiles/libv8_zlib.a obj/tools/v8_gypfiles/libv8_compiler.a obj/tools/v8_gypfiles/libv8_initializers.a obj/tools/v8_gypfiles/libv8_initializers_slow.a  -lz -luv -lbrotlidec -lbrotlienc -lcares -lnghttp2 -lcrypto -lssl -licui18n -licuuc -licudata -ldl -lrt -Wl,--end-group
ld: error: undefined symbol: v8::internal::trap_handler::TryHandleSignal(int, siginfo_t*, void*)
>>> referenced by api.cc:6403 (../../deps/v8/src/api/api.cc:6403)
>>>               ../../deps/v8/src/api/v8_base_without_compiler.api.o:(v8::TryHandleWebAssemblyTrapPosix(int, siginfo_t*, void*)) in archive obj/tools/v8_gypfiles/libv8_base_without_compiler.a

ld: error: undefined symbol: v8::internal::trap_handler::RegisterDefaultTrapHandler()
>>> referenced by handler-outside.cc:260 (../../deps/v8/src/trap-handler/handler-outside.cc:260)
>>>               ../../deps/v8/src/trap-handler/v8_base_without_compiler.handler-outside.o:(v8::internal::trap_handler::EnableTrapHandler(bool)) in archive obj/tools/v8_gypfiles/libv8_base_without_compiler.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Additional information

This is because the v8.gyp was not updated correctly for riscv64 architecture despite it being added here: https://github.com/nodejs/node/commit/cfbf9e0d14c5d0d7465025b39664d3fbcda39dd0#diff-c5f668a7e3a95bb9df5bc165514d324ad89421338302625d614ef5b11a74d18dR6016

I created a patch in our downstream that fixes this: https://github.com/chimera-linux/cports/commit/a82c5ed73c264f9a3fe0ac37762ec4522367fd33

which resulted in node now building fine: https://build.chimera-linux.org/#/builders/1/builds/2090/steps/5/logs/pkg_contrib_nodejs_22_0_0-r0

the conditions in this patch probably aren't entirely correct, as it's a quick fix for our particular environment, i'm not 100% sure what an actual correct patch would be though.

richardlau commented 2 months ago

cc @nodejs/platform-riscv64