Skip to content
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

Unresolved externals when building with NODE_COMPATIBLE=1 #229

Closed
drywolf opened this issue Feb 11, 2017 · 5 comments
Closed

Unresolved externals when building with NODE_COMPATIBLE=1 #229

drywolf opened this issue Feb 11, 2017 · 5 comments

Comments

@drywolf
Copy link
Contributor

drywolf commented Feb 11, 2017

Hi,

I'm trying to build on Windows with NODE_COMPATIBLE=1 set in the compiler options, but then I get the following unresolved functions showing up in the linker. Is there anything special that I need to do when building Node.js to be able to import those functions from it ?

I'm building on Windows 10 with VS 2015.

unresolved external symbol _register_async_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_cares_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_fs_event_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_js_stream referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_buffer referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_contextify referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_crypto referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_fs referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_http_parser referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_os referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_util referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_v8 referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_zlib referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_pipe_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_process_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_signal_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_spawn_sync referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_stream_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_tcp_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_timer_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_tls_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_tty_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_udp_wrap referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
unresolved external symbol _register_uv referenced in function Java_com_eclipsesource_v8_V8__1startNodeJS
@drywolf
Copy link
Contributor Author

drywolf commented Feb 13, 2017

I figured it out.
For anyone else trying to build on Windows:

  • clone the Node.js repo from Github
  • checkout the tag 4.6.0 (or the version that matches the J2V8 release you want to build)
  • change configuration line 187 in vcbuild.bat by adding --enable-static at the end of the arguments
    python configure %configure_flags% %enable_vtune_profiling% --dest-cpu=%target_arch% --tag=%TAG% --enable-static
  • change the following code in node.h and remove the static modifiers in the NODE_C_CTOR macro
#define NODE_C_CTOR(fn)                                               \
  void __cdecl fn(void);                                       \
  __declspec(dllexport, allocate(".CRT$XCU"))                         \
      void (__cdecl*fn ## _)(void) = fn;                              \
  void __cdecl fn(void)
  • build the Node.js static libs by running e.g. vcbuild x64 release

@irbull
Copy link
Member

irbull commented Feb 15, 2017

Thank-you for documenting that here. I completely forgot that I had to do that. I found the hint on electron/node#4

@irbull irbull closed this as completed Feb 15, 2017
@TonyRice
Copy link
Contributor

I followed this and I'm still having some trouble. Is this dependent on a specific version of node?

@TonyRice
Copy link
Contributor

I actually ended up figuring it out. You can easily accomplish this without any change to node.h by some parameters when using vcbuild.bat. I did end up changing my local vcbuild.bat to include a parameter for enable-static

@TonyRice
Copy link
Contributor

TonyRice commented Apr 30, 2017

The vcbuild.bat should be merged into the master node branch soon (nodejs/node#12764)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants