0.2.6 does not compile under windows anymore #30

Closed
matthiasg opened this Issue Mar 5, 2014 · 12 comments

Projects

None yet

3 participants

@matthiasg

i get the following error when npm i heapdump@0.2.6:

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch
.                                                                                                         
 node.lib(node.exe) : error LNK2005: "public: __cdecl v8::Handle<class v8::Object>::Handle<class v8::Objec t>(class v8::Object *)" (??0?$Handle@VObject@v8@@@v8@@QEAA@PEAVObject@1@@Z) already defined in platform-w in32.obj [c:\Development\isis-core\node_modules\heapdump\build\heapdump.vcxproj]
node.lib(node.exe) : error LNK2005: "public: __cdecl v8::Handle<class v8::FunctionTemplate>::Handle<class  v8::FunctionTemplate>(void)" (??0?$Handle@VFunctionTemplate@v8@@@v8@@QEAA@XZ) already defined in platfor m-win32.obj [c:\Development\isis-core\node_modules\heapdump\build\heapdump.vcxproj]
     Creating library c:\Development\isis-core\node_modules\heapdump\build\Release\heapdump.lib and objec
  t c:\Development\isis-core\node_modules\heapdump\build\Release\heapdump.exp
c:\Development\isis-core\node_modules\heapdump\build\Release\heapdump.node : fatal error LNK1169: one or
more multiply defined symbols found [c:\Development\isis-core\node_modules\heapdump\build\heapdump.vcxpro j]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1

gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\Development\isis-core\node_modules\heapdump
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok                                                                                                                                                          

The version 0.2.5 works fine ...

@bnoordhuis
Owner

Frankly, I've no idea what could be causing that. Can you do a git bisect on the range v0.2.5...v0.2.6? Shouldn't take too long, there's only two or three commits.

@matthiasg

6e77f98 is the first bad commit

i dont have node 0.11 installed here (0.10.26) . seems there is a dependency issue then and heapdump with that merge is possible only compatible with node 0.11.x

@bnoordhuis
Owner

Right, I made some changes to make it compile with v0.11, then made some more changes to make it compatible again with v0.10. I suppose that means we're back to square one.

You're the first one to report this. It looks like you're using the Windows SDK. Is trying it with VS 2012 or 2013 an option for you?

If node-gyp doesn't pick up your MSVS install, set GYP_MSVS_VERSION=2012 in the environment first (or 2012e for the Express version, ditto for 2013.)

@bvermeule

I believe I've got the same error.


> heapdump@0.2.6 install C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump
> node-gyp rebuild


C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  heapdump.cc
  platform-win32.cc
c:\users\ndsc\.node-gyp\0.10.23\deps\v8\include\v8.h(184): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handle<T>)' [C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump\build\heapdump.vcxproj]
          with
          [
              T=v8::Object
          ]
node.lib(node.exe) : error LNK2005: "public: __cdecl v8::Handle<class v8::Object>::Handle<class v8::Object>(class v8::Object *)" (??0?$Handle@VObject@v8@@@v8@@QEAA@PEAVObject@1@@Z) already defined in platform-win32.obj [C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump\build\heapdump.vcxproj]
node.lib(node.exe) : error LNK2005: "public: __cdecl v8::Handle<class v8::FunctionTemplate>::Handle<class v8::FunctionTemplate>(void)" (??0?$Handle@VFunctionTemplate@v8@@@v8@@QEAA@XZ) already defined in platform-win32.obj [C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump\build\heapdump.vcxproj]
     Creating library C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump\build\Release\heapdump.lib and object C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump\build\Release\heapdump.exp
C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump\build\Release\heapdump.node : fatal error LNK1169: one or more multiply defined symbols found [C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\heapdump\build\heapdump.vcxproj]

npm output:

npm WARN package.json Notifications@1.0.3 No repository field.
npm WARN package.json Notifications@1.0.3 No README data
npm http GET https://registry.npmjs.org/heapdump
npm http 304 https://registry.npmjs.org/heapdump
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ndsc\Desktop\Projects\notifications-nodejs\node_modules\he
apdump
gyp ERR! node -v v0.10.23
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! heapdump@0.2.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the heapdump@0.2.6 install script.
npm ERR! This is most likely a problem with the heapdump package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls heapdump
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "heapdump" "--save"
npm ERR! cwd C:\Users\ndsc\Desktop\Projects\notifications-nodejs
npm ERR! node -v v0.10.23
npm ERR! npm -v 1.3.17
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\ndsc\Desktop\Projects\notifications-nodejs\npm-debug.log
npm ERR! not ok code 0

Doing 'set GYP_MSVS_VERSION=2012' or 'set GYP_MSVS_VERSION=2013' does not work.

@bnoordhuis
Owner

I have frankly no idea what might be causing that. I suppose it's because src/platform-win32.cc now includes v8.h but I don't see why that results in link errors; the classes that the linker complains about are not even used in that file.

@bvermeule

This is all quite beyond my scope of knowledge but a quick Google led me to: https://groups.google.com/forum/#!msg/nodejs/onA0S01INtw/ZnfKyN7sGAsJ

I see that heapdump.h includes v8.h, where heapdump.cc includes heapdump.h as the first header. Could it be that, like the forum post explains, that node.h needs to be included before the v8.h in heapdump.h gets included?

I can test this if you can direct me how to compile the package outside of npm.

@bnoordhuis
Owner

I can test this if you can direct me how to compile the package outside of npm.

That's easy, clone the repo and run node-gyp rebuild from the top-level directory.

@bvermeule

Looks like adding the node.h include in platform-win32.cc fixed it.

     Creating library C:\Users\ndsc\Desktop\Projects\node-heapdump\build\Release\heapdump.lib and object C:\Users\ndsc\Desktop\Projects\node-heapdump\build\
  Release\heapdump.exp
  Generating code
  Finished generating code
  heapdump.vcxproj -> C:\Users\ndsc\Desktop\Projects\node-heapdump\build\Release\\heapdump.node
gyp info ok
@bnoordhuis
Owner

Okay, thanks, that's useful info. Does that mean that this patch fixes the build?

diff --git a/src/heapdump.h b/src/heapdump.h
index e8b5d64..fe3c7f9 100644
--- a/src/heapdump.h
+++ b/src/heapdump.h
@@ -17,6 +17,7 @@
 #ifndef NODE_HEAPDUMP_H_
 #define NODE_HEAPDUMP_H_

+#include "node.h"  // Picks up BUILDING_NODE_EXTENSION on Windows, see #30.
 #include "v8.h"

 namespace heapdump
@bvermeule

Yes, that makes it build for me. I haven't been able to test the actual functionality yet but I would assume that's fine.

@bnoordhuis bnoordhuis added a commit that closed this issue Mar 16, 2014
@bnoordhuis src: fix windows build
Include node.h so the BUILDING_NODE_EXTENSION macro can work its magic
and exports V8 functions and types properly.  Fixes the following
build error:

    node.lib(node.exe) : error LNK2005: "public: __cdecl
    v8::Handle<class v8::Object>::Handle<class v8::Object>(class
    v8::Object *)" (??0?$Handle@VObject@v8@@@v8@@QEAA@PEAVObject@1@@Z)
    already defined in platform-win32.obj
    node.lib(node.exe) : error LNK2005: "public: __cdecl
    v8::Handle<class v8::FunctionTemplate>::Handle<class
    v8::FunctionTemplate>(void)"
    (??0?$Handle@VFunctionTemplate@v8@@@v8@@QEAA@XZ) already defined
    in platform-win32.obj

Fixes #30.
27f4158
@bnoordhuis
Owner

Thanks Björn, fixed in 27f4158 and published as v0.2.7.

@bvermeule

Just tested by installing from npm and was able to create a snapshot. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment