Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Node.js would not compile with --debug --v8-non-optimized-debug #38571

Closed
john-yan opened this issue May 6, 2021 · 6 comments · Fixed by #38576
Closed

Node.js would not compile with --debug --v8-non-optimized-debug #38571

john-yan opened this issue May 6, 2021 · 6 comments · Fixed by #38576
Labels
build Issues and PRs related to build files or the CI.

Comments

@john-yan
Copy link

john-yan commented May 6, 2021

  • Version: master
  • Platform: Ubuntu
  • Subsystem: X64 or PPC64LE

What steps will reproduce the bug?

./configure --debug --v8-non-optimized-debug
make -j32

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

Consistently

What is the expected behavior?

compilation successful

What do you see instead?

Linker fail because a ton of undefined ref
eg.

/workdir/node/out/Debug/obj/gen/torque-generated/src/objects/fixed-array-tq-inl.inc:287: undefined reference to `v8::internal::IsFixedArrayBase_NonInline(v8::internal::HeapObject)'
/usr/bin/ld: /workdir/node/out/Debug/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/embedded-file-writer.o: in function `v8::internal::TorqueGeneratedByteArray<v8::internal::ByteArray, v8::internal::FixedArrayBase>::TorqueGeneratedByteArray(unsigned long)':
/workdir/node/out/Debug/obj/gen/torque-generated/src/objects/fixed-array-tq-inl.inc:349: undefined reference to `v8::internal::IsByteArray_NonInline(v8::internal::HeapObject)'
/usr/bin/ld: /workdir/node/out/Debug/obj.target/v8_base_without_compiler/deps/v8/src/api/api.o: in function `v8::internal::TorqueGeneratedPrimitiveHeapObject<v8::internal::PrimitiveHeapObject, v8::internal::HeapObject>::TorqueGeneratedPrimitiveHeapObject(unsigned long)':
/workdir/node/out/Debug/obj/gen/torque-generated/src/objects/primitive-heap-object-tq-inl.inc:4: undefined reference to `v8::internal::IsPrimitiveHeapObject_NonInline(v8::internal::HeapObject)'
/usr/bin/ld: /workdir/node/out/Debug/obj.target/v8_base_without_compiler/deps/v8/src/api/api.o: in function `v8::internal::TorqueGeneratedHeapNumber<v8::internal::HeapNumber, v8::internal::PrimitiveHeapObject>::TorqueGeneratedHeapNumber(unsigned long)':
/workdir/node/out/Debug/obj/gen/torque-generated/src/objects/heap-number-tq-inl.inc:15: undefined reference to `v8::internal::IsHeapNumber_NonInline(v8::internal::HeapObject)'
/usr/bin/ld: /workdir/node/out/Debug/obj.target/v8_base_without_compiler/deps/v8/src/api/api.o: in function `v8::internal::TorqueGeneratedJSProxy<v8::internal::JSProxy, v8::internal::JSReceiver>::TorqueGeneratedJSProxy(unsigned long)':

Additional information

Some of the torque generated .cc are not being compiled to .o eg. fixed-array-tq.o. Therefore, at the linking step, definition are missing. I suspect either gpy is not working or the GN scraper is not working as expected. I also check the Release build, fixed-array-tq.o is also missing but for some reason it compiles OK. All the torque generated .cc file are compiled to .o by GN+ninja on standalone v8 compilation.

@john-yan
Copy link
Author

john-yan commented May 6, 2021

diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index 377e12d1fd..f34e4480ee 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -166,6 +166,7 @@
           '<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.h',
           '<(SHARED_INTERMEDIATE_DIR)/torque-generated/factory.cc',
           '<(SHARED_INTERMEDIATE_DIR)/torque-generated/objects-printer.cc',
+          '<@(torque_outputs_cc)'
         ],
         'include_dirs': [
           '<(SHARED_INTERMEDIATE_DIR)',

This is a potential solution. Any advice?

@richardlau
Copy link
Member

richardlau commented May 6, 2021

It does looks like the torque_generated_definitions target in the gyp file is missing the equivalent of

node/deps/v8/BUILD.gn

Lines 1618 to 1625 in e46c680

foreach(file, torque_files) {
filetq = string_replace(file, ".tq", "-tq")
sources += [
"$target_gen_dir/torque-generated/$filetq-inl.inc",
"$target_gen_dir/torque-generated/$filetq.cc",
"$target_gen_dir/torque-generated/$filetq.inc",
]
}

@john-yan
Copy link
Author

john-yan commented May 6, 2021

@richardlau my patch actually works (compilation successful) but I am not sure if that's the right thing to do.

@richardlau
Copy link
Member

@john-yan Yeah, sorry, I tried a fresh checkout and both patches work. I think adding the files is the right thing to do here, I'll open a PR.

@richardlau
Copy link
Member

PR: #38576

@Ayase-252 Ayase-252 added the build Issues and PRs related to build files or the CI. label May 7, 2021
@john-yan
Copy link
Author

john-yan commented May 7, 2021

Thanks @richardlau for helping out!

targos pushed a commit that referenced this issue May 17, 2021
The `torque_generated_definitions` target is missing some torque
generated files in its sources list when compared to the equivalent
target in V8's BUILD.gn.

PR-URL: #38576
Fixes: #38571
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants