Unresolved symbols when compiling native node module (node-julia) with nw-gyp on Windows

286 views
Skip to first unread message

Tiago Gehring

unread,
Nov 23, 2015, 1:08:07 PM11/23/15
to nw.js
Hi,

I'm trying to create an application with node-webkit that has also to call some Julia code. However, when trying to compile the module code using nw-gyp (since it makes use of native code) I'm getting some unresolved external symbols:

request.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) bool __cdecl node::Buffer::HasInstance(class v8::Local<class v8::Value>)" (__imp_?HasInstance@Buffer@node@@YA_NV?$Local@VValue@v8@@@v8@@@Z)
1>request.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) char * __cdecl node::Buffer::Data(class v8::Local<class v8::Object>)" (__imp_?Data@Buffer@node@@YAPEADV?$Local@VObject@v8@@@v8@@@Z)
1>request.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) unsigned __int64 __cdecl node::Buffer::Length(class v8::Local<class v8::Object>)" (__imp_?Length@Buffer@node@@YA_KV?$Local@VObject@v8@@@v8@@@Z)
1>nj-v11.obj : error LNK2001: unresolved external symbol __imp_node_module_register
1>nj-v11.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class v8::MaybeLocal<class v8::Object> __cdecl node::Buffer::New(class v8::Isolate *,unsigned __int64)" (__imp_?New@Buffer@node@@YA?AV?$MaybeLocal@VObject@v8@@@v8@@PEAVIsolate@4@_K@Z)
1>nj-v11.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) char * __cdecl node::Buffer::Data(class v8::Local<class v8::Value>)" (__imp_?Data@Buffer@node@@YAPEADV?$Local@VValue@v8@@@v8@@@Z)
1>nj-v11.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class v8::Local<class v8::Value> __cdecl node::MakeCallback(class v8::Isolate *,class v8::Local<class v8::Object>,class v8::Local<class v8::Function>,int,class v8::Local<class v8::Value> *)" (__imp_?MakeCallback@node@@YA?AV?$Local@VValue@v8@@@v8@@PEAVIsolate@3@V?$Local@VObject@v8@@@3@V?$Local@VFunction@v8@@@3@HPEAV23@@Z)

This is on Windows 10 and node-webkit version 0.13.0-alpha4 headers (since I didn't find the ones for version alpha5) using either Visual Studio 2013 or 2015 (for the latter I had to make small changes to nw-gyp Visual Studio version detection code since it seems not to support VS2015 yet). Visual Studio 2012 could not parse the nw-headers (probably because of lacking C++11 support) so I assume that this version is deprecated. I though that perhaps the problem is the older nw.lib (for the alpha4 release), so I generated a new one for my alpha5 installation but this also didn't work; I get the same list of missing exports. Since the problem -- missing code in nw.dll or some mismatched headers -- seems to be with nw.js itself and not with nw-gyp I'm posting here, I hope that it is the right place.  

To configure/build the code I just call

nw-gyp configure --target=0.13.0-alpha4

and 

nw-gyp build

as stated in the documentation. The node module compiles and works fine with node-gyp and node v5.0.0.

As a side question is there some documentation available on how to generate the nw-headers?

Best regards,
Tiago Gehring

Roger Wang

unread,
Nov 23, 2015, 8:53:52 PM11/23/15
to nw.js
Hello,

There is bug in native module support in alpha4. In alpha5 we fixed it and now native modules can be built with upstream 'node-gyp' directly. Just add proper '--dist-url' and '--target' argument to it. The fix is only tested on Linux. It may have issue on Windows. We'll see it in alpha6 release.

btw, the header is built by 'tools/package_binary.py' and 'tools/make-nw-headers.py'. You can check the build log in the buildbot: 
http://buildbot-master.node-webkit.org:8010/builders/nw13_sdk_mac64/builds/54/steps/ninja_release_dist/logs/stdio

Roger

Tiago Gehring

unread,
Nov 23, 2015, 9:31:56 PM11/23/15
to nw.js
Hi Roger,

Many thanks, this clarifies things a lot. However, I tried to build the node module with node-gyp but I'm probably still missing something or using the wrong URL (how can I tell it to look for "nw.lib" and not "node.lib"?).  

node-gyp configure --target=0.13.0-alpha5 --arch=x64 --dist-url=http://dl.nwjs.io/ --runtime=node-webkit
gyp info it worked if it ends with ok
gyp info using node...@3.1.0
gyp info using no...@5.0.0 | win32 | x64
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 404 status code downloading 64-bit node.lib

Thanks again,
Tiago

--
You received this message because you are subscribed to a topic in the Google Groups "nw.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nwjs-general/-bOc1ai8u3E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nwjs-general...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roger Wang

unread,
Nov 24, 2015, 11:57:35 PM11/24/15
to nw.js
It's working on Linux. Unfortunately when I was looking into it for windows later, it's found that it's hard to be supported with the upstream node-gyp. So in the coming alpha6 release, native modules are still to be supported by nw-gyp, which was updated today.

Thanks,

Roger
To unsubscribe from this group and all its topics, send an email to nwjs-general+unsubscribe@googlegroups.com.

Tiago Gehring

unread,
Nov 27, 2015, 8:52:22 AM11/27/15
to nw.js
Many thanks Roger, I managed to compile the node-julia module on Windows with the new nw-gyp version + the 0.13 alpha6 headers. The only change that I made is to add VS 2015 to the visual studio detection code (a trivial change).  

Thanks again,
Tiago 

To unsubscribe from this group and all its topics, send an email to nwjs-general...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "nw.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nwjs-general/-bOc1ai8u3E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nwjs-general...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages