nodejs / node

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

Build Failure: error: undefined symbol: sf_parser_init #54195

Open orbea opened 3 months ago

orbea commented 3 months ago

Version

https://github.com/nodejs/node/commit/d172da8d0197a71d473ee879eacd1061b316bdf2

Platform

Linux gentoo 6.6.43-x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 30 12:29:53 PDT 2024 x86_64 AMD Ryzen 9 7900X 12-Core Processor AuthenticAMD GNU/Linux

Subsystem

ngtcp2

What steps will reproduce the bug?

Compile node, some configurations may avoid this issue somehow?

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

Always on affected systems.

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

The compile should succeed without undefined references.

What do you see instead?

The build fails with an undefined reference to sf_parser_dict when compiling node_mksnapshot.

ninja: job failed: clang++ -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed --rtlib=libgcc --unwindlib=libgcc -pthread -rdynamic -Wl,-z,noexecstack -Wl,--whole-archive obj/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive -Wl,-z,relro -Wl,-z,now -Wl,--whole-archive,obj/deps/openssl/libopenssl.a -Wl,--no-whole-archive -m64 -o node_mksnapshot -Wl,--start-group obj/src/node_mksnapshot.node_snapshot_stub.o obj/tools/snapshot/node_mksnapshot.node_mksnapshot.o obj/libnode.a obj/deps/histogram/libhistogram.a obj/deps/sqlite/libsqlite.a obj/deps/ada/libada.a obj/deps/nbytes/libnbytes.a obj/deps/simdjson/libsimdjson.a obj/deps/simdutf/libsimdutf.a obj/deps/ncrypto/libncrypto.a obj/tools/v8_gypfiles/libv8_snapshot.a obj/tools/v8_gypfiles/libv8_libplatform.a obj/deps/llhttp/libllhttp.a obj/deps/uvwasi/libuvwasi.a obj/deps/openssl/libopenssl.a obj/deps/ngtcp2/libnghttp3.a obj/tools/v8_gypfiles/libv8_base_without_compiler.a obj/tools/v8_gypfiles/libv8_libbase.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_turboshaft.a obj/tools/v8_gypfiles/libv8_initializers.a obj/tools/v8_gypfiles/libv8_initializers_slow.a obj/deps/ngtcp2/libngtcp2.a  -lz -luv -lsimdjson -lbrotlidec -lbrotlienc -lcares -lnghttp2 -lngtcp2 -lsqlite3 -licui18n -licuuc -licudata -latomic -ldl -Wl,--end-group
ld.lld: error: undefined symbol: sf_parser_init
>>> referenced by nghttp3_http.c
>>>               nghttp3/lib/nghttp3.nghttp3_http.o:(nghttp3_http_parse_priority) in archive obj/deps/ngtcp2/libnghttp3.a

ld.lld: error: undefined symbol: sf_parser_dict
>>> referenced by nghttp3_http.c
>>>               nghttp3/lib/nghttp3.nghttp3_http.o:(nghttp3_http_parse_priority) in archive obj/deps/ngtcp2/libnghttp3.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: subcommands failed

Additional information

The missing function is in deps/ngtcp2/nghttp3/lib/sfparse.c

https://github.com/nodejs/node/blob/d172da8d0197a71d473ee879eacd1061b316bdf2/deps/ngtcp2/nghttp3/lib/sfparse.c#L1023-L1032

This file is commented in deps/ngtcp2/ngtcp2.gyp.

https://github.com/nodejs/node/blob/d172da8d0197a71d473ee879eacd1061b316bdf2/deps/ngtcp2/ngtcp2.gyp#L83-L84

The simple solution would be to uncomment it.

orbea commented 3 months ago

This was also reported for the Gentoo issue tracker.

https://bugs.gentoo.org/932534

RedYetiDev commented 2 months ago

The proposed patch would be:

--- a/deps/ngtcp2/ngtcp2.gyp
+++ b/deps/ngtcp2/ngtcp2.gyp
@@ -81,7 +81,7 @@
       'nghttp3/lib/nghttp3_vec.c',
       'nghttp3/lib/nghttp3_version.c',
       # sfparse is also used by nghttp2 and is included by nghttp2.gyp
-      # 'nghttp3/lib/sfparse.c'
+      'nghttp3/lib/sfparse.c'
     ]
   },
   'targets': [
RedYetiDev commented 2 months ago

CC @nodejs/quic