Repository navigation
Assertion `(source_it) != (source_.end())' failed while doing make #39408
Copy link
Copy link
Closed
Description
Version
master
Platform
Linux 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
build
What steps will reproduce the bug?
$./configure
$make -j4
ACTION _home_gireesh_node_node_gyp_node_target_node_mksnapshot /home/gireesh/node/out/Release/obj/gen/node_snapshot.cc
/home/gireesh/node/out/Release/node_mksnapshot[660863]: ../src/node_native_module.cc:226:v8::MaybeLocal<v8::String> node::native_module::NativeModuleLoader::LoadBuiltinModuleSource(v8::Isolate*, const char*): Assertion `(source_it) != (source_.end())' failed.
1: 0x55d5331d5ee4 node::Abort() [/home/gireesh/node/out/Release/node_mksnapshot]
2: 0x55d5331d5f78 [/home/gireesh/node/out/Release/node_mksnapshot]
3: 0x55d5333f8fdd node::native_module::NativeModuleLoader::LoadBuiltinModuleSource(v8::Isolate*, char const*) [/home/gireesh/node/out/Release/node_mksnapshot]
4: 0x55d5333f95d1 node::native_module::NativeModuleLoader::LookupAndCompile(v8::Local<v8::Context>, char const*, std::vector<v8::Local<v8::String>, std::allocator<v8::Local<v8::String> > >*, node::native_module::NativeModuleLoader::Result*) [/home/gireesh/node/out/Release/node_mksnapshot]
5: 0x55d533234649 node::native_module::NativeModuleEnv::LookupAndCompile(v8::Local<v8::Context>, char const*, std::vector<v8::Local<v8::String>, std::allocator<v8::Local<v8::String> > >*, node::Environment*) [/home/gireesh/node/out/Release/node_mksnapshot]
6: 0x55d53336f36e node::InitializePrimordials(v8::Local<v8::Context>) [/home/gireesh/node/out/Release/node_mksnapshot]
7: 0x55d53336f560 node::GetPerContextExports(v8::Local<v8::Context>) [/home/gireesh/node/out/Release/node_mksnapshot]
8: 0x55d53336f2a0 node::InitializePrimordials(v8::Local<v8::Context>) [/home/gireesh/node/out/Release/node_mksnapshot]
9: 0x55d53336f695 node::NewContext(v8::Isolate*, v8::Local<v8::ObjectTemplate>) [/home/gireesh/node/out/Release/node_mksnapshot]
10: 0x55d53327a4a9 node::SnapshotBuilder::Generate(node::SnapshotData*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) [/home/gireesh/node/out/Release/node_mksnapshot]
11: 0x55d53327b014 node::SnapshotBuilder::Generate(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) [/home/gireesh/node/out/Release/node_mksnapshot]
12: 0x55d532e05d7d main [/home/gireesh/node/out/Release/node_mksnapshot]
13: 0x7f89037610b3 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
14: 0x55d532e0e46e _start [/home/gireesh/node/out/Release/node_mksnapshot]
Aborted (core dumped)
make: *** [node.target.mk:26: /home/gireesh/node/out/Release/obj/gen/node_snapshot.cc] Error 134
rm 2561388a0ca6c2168de218f405f8f7b697c77862.intermediate 9d285d3140c975d071f47f872a2170cedfc46bc5.intermediate aaef1ed75da9c226afcc645ea47e3916fde6ec36.intermediate
How often does it reproduce? Is there a required condition?
everytime
What is the expected behavior?
node builds successfully
What do you see instead?
build crashes
Additional information
first time I am building in this system, so suspect something specific to build toolchain versions, resource limit etc. but cannot figure out what.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
legendecas commentedon Jul 16, 2021
This is typically for built in module not been found.
Can you re-configure to generate refresh new build scripts and try again?Edit: just found that one of the re-production steps is
./configure. There is a change on master branch recently that all builtin module files were globbed to be bundled into node binary. You may check on the variablenode_library_filesinconfig.gypito see if it is present and find out if there are any files missing from the list.legendecas commentedon Jul 20, 2021
@gireeshpunathil does that help?
gireeshpunathil commentedon Jul 20, 2021
@legendecas - thanks for the pointers provided, unfortunately, I did not have time to look at that yet. I will try to squeeze in sometime this week. Meanwhile, does it help if I recreate this in a docker image and pass it to you for your inspection?
gireeshpunathil commentedon Jul 20, 2021
@legendecas - this was super-quick and super-useful!!!
this is what I get with your patch. How do I fix this now? Any idea?
legendecas commentedon Jul 20, 2021
That sounds like a problem on the
config.gypi, i.e. no files are included in the build --internal/per_context/primordialsis the first file been evaluated during the snapshot process.Can you
./configureagain?gireeshpunathil commentedon Jul 20, 2021
In one system:
In another system:
I am confused. :)
legendecas commentedon Jul 20, 2021
@gireeshpunathil if the first output is the problem behaving one, can you try this command
python3 -c 'import sys;sys.path.insert(0, \'tools\');from utils import SearchFiles;print(SearchFiles(\'lib\', \'js\'))'on the system that has the problem?gireeshpunathil commentedon Jul 20, 2021
@legendecas - here it is:
gireeshpunathil commentedon Jul 20, 2021
@legendecas - I think at this point I should mention this - now that you are bringing python into the issue:
I had to make this change in utils.py, as without that it was giving an error that the the function does not take the second parameter. Do you think this could have any effect on the failure that we are seeing?
legendecas commentedon Jul 20, 2021
@gireeshpunathil I believe that option is exactly the issue here. Can you share the error when the function takes the second parameter?
gireeshpunathil commentedon Jul 20, 2021
targos commentedon Jul 20, 2021
This should have been fixed by #39293
gireeshpunathil commentedon Jul 20, 2021
@targos - unfortunately, does not look like it fixed it, I am still getting the same error.
legendecas commentedon Jul 20, 2021
I was wondering if the
./configureused a different version (as printed above as 3.8.10) with the build step oftools/js2c.py(probably 2.x or 3.5 lower).legendecas commentedon Jul 20, 2021
Build step of node_js2c: https://github.com/nodejs/node/blob/master/node.gyp#L820
Used in
tools/js2c.py: https://github.com/nodejs/node/blob/master/tools/js2c.py#L219So the problem here is that #39293 is hoisting the result of search files. However,
node_js2cdid not use the variable but the directories instead for shorter argument lines. Whilejs2c.pyis invoked with default or whatever python that version is lower than 3.5 then it works in an unexpected way.1 remaining item
src: print native module id on native module not found
src: print native module id on native module not found
legendecas commentedon Jul 25, 2021
@gireeshpunathil As the comment #39465 (comment) suggests, can you check out the content of
./config.mk(which is generated by./configure), and ifout/tool/bin/pythonpresents and where does it linking to? I tested on a Linux system with both python2 and python3 installed andpythoninPATHis linking to python2, sadly the problem didn't present.gireeshpunathil commentedon Jul 25, 2021
cat config.mk
@legendecas - here is the dump of
config.mkas well as the details of various python installations. Though it (the soft link business) looks little funny to me, I don't see any evident issue with the whole setup, but will leave it to you to comment!legendecas commentedon Jul 26, 2021
@gireeshpunathil it seems that python2 is not even in your path, so
./configuredoesn't generate bin overrides inconfig.mkandout/tool/bin/python. I'm wondering if there is any python2 installation in your local environment and the build script somehow to reveal that? 🧐gireeshpunathil commentedon Jul 26, 2021
@legendecas - no, I don't have python2 in my path, as I never installed one. Am I supposed to? The build instructions at https://github.com/nodejs/node/blob/master/BUILDING.md#note-about-python do not specify to do so?
legendecas commentedon Jul 26, 2021
@gireeshpunathil No, you don't have to install python2. I'm just wondering where did the python2 pop out during the build and how do we override the
pythoninPATH.src: print native module id on native module not found
build: override python executable path on configure
build: override python executable path on configure
src: print native module id on native module not found
build: override python executable path on configure
build: override python executable path on configure