-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Missing symbols in node.lib #7104
Comments
They should be in nw.lib, which should be included in the linking. And that's one of the reasons we provide |
No they are not in
And
|
Looks like those 3 functions are inlined when NW is built since their definitions are in the v8 header. But they are not inlined when the native module is built... |
If I remember correctly you need to tell Microsoft Visual Studio to explicitly to export inlined functions as symbols. |
From From
So all member functions in that class should be exported when building a DLL. From If the DLL:s are correctly built with See: |
NW is built with clang with different flags following chromium project, while native modules are built with msvc. Will look into it. |
PS, NW is built with BUILDING_V8_SHARED, or other v8 symbols won't be visible. |
Could it be that you are building with this flag? |
The switch is needed or there will be build error when build v8. It conficts with btw, upstream is also using this switch under component build: https://cs.chromium.org/chromium/src/build/config/win/BUILD.gn?q=is_component_build&dr=C&l=118 |
@ermod try to use clang when building node |
I think I encounter the same problem when I try to build node.dll (both x86 and x64) after built nwjs successfully. the version is nw40 branch(I tried 0.39 also). [1/1] LINK_EMBED(DLL) node.dll
lld-link: error: undefined symbol: public: virtual enum v8::OutputStream::WriteResult __thiscall v8::OutputStream::WriteHeapStatsChunk(struct v8::HeapStatsUpdate *, int)
lld-link: error: undefined symbol: __declspec(dllimport) protected: __thiscall v8::String::ExternalOneByteStringResource::ExternalOneByteStringResource(void)
lld-link: error: undefined symbol: protected: virtual void __thiscall v8::String::ExternalStringResourceBase::Dispose(void)
lld-link: error: undefined symbol: public: virtual bool __thiscall v8::String::ExternalStringResourceBase::IsCacheable(void) const
lld-link: error: undefined symbol: protected: virtual void __thiscall v8::String::ExternalStringResourceBase::Lock(void) const
lld-link: error: undefined symbol: protected: virtual void __thiscall v8::String::ExternalStringResourceBase::Unlock(void) const
lld-link: error: undefined symbol: protected: virtual void __thiscall v8::String::ExternalStringResourceBase::Dispose(void)
lld-link: error: undefined symbol: public: virtual bool __thiscall v8::String::ExternalStringResourceBase::IsCacheable(void) const
lld-link: error: undefined symbol: protected: virtual void __thiscall v8::String::ExternalStringResourceBase::Lock(void) const
lld-link: error: undefined symbol: protected: virtual void __thiscall v8::String::ExternalStringResourceBase::Unlock(void) const
|
I think the real problem is in the nwjs v8 module. The current version of nwjs v8 seemed to missing this symbols. |
I really hope @rogerwang will fix this asap as currently we are unable to compile any native modules in 0.39+, even not on 0.41-beta1 - all due to the error above of missing symbols. At least not on Windows |
Maybe this is all also related to the many compiler warnings we get:
all about using the new dllexportsinlines option in the CL compiler. And that option is not yet implemented on the older MSVS toolchain 2015/2017 It is coming up thought: |
@rogerwang after further investigation it seems that V8 and Chrome building switched to clang-cl compiler on windows, so that is why the building process fails with missing externals. see: The MS CL compiler doesn't support the '/Zc:dllexportInlines-' option while the clang replacement clang-cl does. The LLVM clang-cl tools can be installed from: https://llvm.org/builds/ So nw-gyp and the building instructions should be tweaked to support clang-cl |
I succeeded to compile the node.dll (windows 10 version) finally (both 0.40 and 0.41). I remove the V8_SHARED and USING_V8_SHARED from node.ninja, and I also remove the '/Zc:dllexportInlines-' flag (decrease the warning). I think when is_compont_build=false with clang, the BUILDING_V8_SHARED has no sense to nw/nw.dll. Hope this give you some hints. |
great news @jiangjianping ! I knew it will be something easy like this. Now we just have to figure out what needs to be changed in nw-gyp so we can also build the native node modules for nwjs. Hope @rogerwang can give some light to this soon. |
@jiangjianping another v8 will be compiled into node DLL if it's built in this way and it would be problematic since there will be 2 copies of v8 instances (e.g. different static local variables etc) |
@rogerwang, |
I can confirm that modules with this issue can be built successfully with clang-cl.exe and lld-link.exe. Will push an update of nw-gyp soon. |
nw-gyp 3.6.5 is published for the complete fix. Thanks. |
Thanks! |
NWJS Version : 0.39.2
Operating System : Windows 10
node.lib
is missing the following symbols:These symbols exists in the 12.4.0
node-gyp
version ofnode.lib
But not in the 0.39.2
nw-gyp
version ofnode.lib
An other way to see this fault and the consequences of it is to create a project that is dependent of
node-lmdb
version 0.7.0 and the try to rebuild it with nw-gypThe build will fail with the following error:
The text was updated successfully, but these errors were encountered: