Node: Linker error, while compiling node js from source (as a shared library) - v 6.11.2

Created on 5 Sep 2017  路  7Comments  路  Source: nodejs/node

  • Version: 6.11.2
  • Platform: Windows
  • Subsystem: build,shared


I am trying to compile node js as a shared library from source on Windows.
Currently i am following vcbuild.bat - by passing "release" "x64" "dll" as arguments to the script.
Error (listing only one, but contains about 50+ all linker errors to v8_base_3.lib):

v8_base_3.lib(api.obj) : error LNK2005: "public: __cdecl v8::HandleScope::HandleScope(class v8::Isolate *)" (??0HandleScope@v8@@QEAA@PEAVIsolate@1@@Z) already defined in node.lib(node.dll) [D:\node-v6.11.2\cctest.vcxproj]

refack: formatted

build embedding windows

All 7 comments

you reinstall and install node.js in http://nodejs.org/download in linux
and write code
$ tar -zxf node-v0.12.4.tar.gz
$ cd node-v0.12.4
$ ./configure
$ make
$ sudo make install

and success

@rao-krish sorry, I can't reproduce.

Could you provide more details? OS version, Visual Studio version, how did you obtain the code?

@rao-krish this is an annoying but a non critical error. The build process tried to build the C++ test harness cctest only after it finishes building node.dll. I think if you look in /Release/ you'll find a completed node.dll.
Anyway we currently have no harness for testing node.dll, so the following steps of vcbuild.bat are irrelevant.

This could also might happen if by any chance you are reusing previous build products (from [email protected] for example)...
Refs: https://github.com/nodejs/node/pull/13078
Refs: https://github.com/nodejs/node/issues/14158

Looks like this has been answered and OP hasn't commented since. Closing, reopen if that is a mistake.

@bzoz steps followed:
i downloaded the source from nodejs.org - for the latest LTS release
command line options: vcbuild.bat dll x64 release
OS version - Windows 10 , Visual Studio version 2015

@refack
I could see the dll and lib files generated, but since there is a linker error, i am not sure if it will work well when used in electron-atom environment, and hence i wonder if it is to do with the error when compiled.

However i am still facing this issue.

Thanks all for your inputs.

@rao-krish I'm trying to reproduce locally. Meanwhile since the error you posted is already defined I have a strong intuition that the node.dll will work.

___But___ be aware that electron/atom float patches over "vanilla" node: https://github.com/electron/node/compare/8d426bbee...electron

@bzoz following the above steps reproduces
https://gist.github.com/refack/c28d94cc2ed0ee5d8408bb1aa68af35c

@rao-krish all the errors I'm seeing (~225) are multiple definition, which IMHO hints that all needed symbols __are__ exported by node.dll

Was this page helpful?
0 / 5 - 0 ratings