-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link issue with static library of nodejs #27431
Comments
I am running into the same error attempting to build with the dll option.
this occurs after running vcbuild dll x86 |
Hello @wolfviking0 and @Cian-Chambliss, this is probably a bug (regression) introduced in #27161. Up until that change we used to link the code-cache symbols into the intermediary I'm working on a fix. |
P.S. as a workaround you could link your final binary with either the code cache stub ( |
@refack thanks, I used this approach initially in order to link, but because I am using node with swig I need to revert back to an older version of nodejs 10.15.3. |
Thanks, adding node_code_cache.cc as you suggested to the nodelib.vcxproj fixed that project. |
Seeing the same linking errors with libnode (12.1.0) which is now in the Debian experimental branch. Here the error appears when external software (in this case |
Also failing on Fedora Rawhide with |
Is there anyone who can take a look at this? This is blocking node 12 on Fedora and Debian now. |
@joyeecheung I tried to patch this but I realized we probably need to fix this: Lines 1161 to 1166 in 62a809f
The reason why the shared library is currently missing the code cache symbols is because of the cyclical dependency between We need The solution is exactly as said in the comment above: modify the |
This is needed for external applications that link to shared libnode. Fixes #27431 PR-URL: #28897 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Hello, I want to use nodejs with swig. In order to do that I need to link my library with node.
But I cannot build shared library for nodejs only static (it's a requirement). So I build node js using this config ./configure --prefix=${NODEJS_INSTALL} --enable-static
So far everything build fine and smoothly, but when I link I have some missing symbol related to cache:
"node::native_module::has_code_cache"
"node::native_module::NativeModuleEnv::InitializeCodeCache()"
I am not sure what I am doing wrong, it seems this file can be autogenerated but not sure why is missing. I also try using whole archive when linking but change nothing.
Any thought ?
LINK ERROR :
Undefined symbols for architecture x86_64:
"node::native_module::has_code_cache", referenced from:
node::Initialize(v8::Localv8::Object, v8::Localv8::Value, v8::Localv8::Context) in libnode.a(node_config.o)
"node::native_module::NativeModuleEnv::InitializeCodeCache()", referenced from:
node::InitializeNodeWithArgs(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >*) in libnode.a(node.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
The text was updated successfully, but these errors were encountered: