msgpack / msgpack-node

MessagePack implementation for Node.js
Other
311 stars 71 forks source link

Failed to compile on Windows #15

Closed khuongduybui closed 10 years ago

khuongduybui commented 10 years ago

I'm using Windows 8.1 x64. I have Visual Studio 2013 (Ultimate), VC++ redistributable 2005, 2008, 2011, both x86 and x64.

EDIT: node version: 0.10.26, npm version: 1.4.3

When trying to npm install msgpack, I received the following errors:

c:\users\duy\code\node_modules\msgpack\deps\msgpack\msgpack\pack_template.h(716):
warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned char', possible loss of data (..\..\..\deps\msgpack\objectc.c)
[C:\Users\Duy\Code\no
de_modules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
c:\users\duy\code\node_modules\msgpack\deps\msgpack\msgpack\pack_template.h(737):
warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned char', possible loss of data (..\..\..\deps\msgpack\objectc.c)
[C:\Users\Duy\Code\no
de_modules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
c:\users\duy\code\node_modules\msgpack\deps\msgpack\msgpack\pack_template.h(773):
warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int', possible loss of data (..\..\..\deps\msgpack\objectc.c)
[C:\Users\Duy\Code\node_mo
dules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
c:\users\duy\code\node_modules\msgpack\deps\msgpack\msgpack\pack_template.h(716):
warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned char', possible loss of data (..\..\..\deps\msgpack\version.c)
[C:\Users\Duy\Code\no
de_modules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
c:\users\duy\code\node_modules\msgpack\deps\msgpack\msgpack\pack_template.h(737):
warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned char', possible loss of data (..\..\..\deps\msgpack\version.c)
[C:\Users\Duy\Code\no
de_modules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
c:\users\duy\code\node_modules\msgpack\deps\msgpack\msgpack\pack_template.h(773):
warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int', possible loss of data (..\..\..\deps\msgpack\version.c)
[C:\Users\Duy\Code\node_mo
dules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
c:\users\duy\code\node_modules\msgpack\deps\msgpack\msgpack\type/tr1/unordered_map.hpp(22):
fatal error C1083: Cannot open include file: 'tr1/unordered_map': No such file or directory (..\..\..\deps\msgpack\object.cpp)
[C:\Users\Duy\Cod
e\node_modules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\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:\Users\Duy\Code\node_modules\msgpack
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! msgpack@0.2.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
htaox commented 10 years ago

They are of STD, so take out "tr1/".

Compiled after changing to below:

unordered_map.hpp

include

unordered_set.hpp

include

danielabar commented 10 years ago

I'm having the same problem on Windows 8.1 64 bit with Visual Studio 2013 Express. It looks like the above comment is a solution, but I don't understand, what does it mean: "They are of STD, so take out tr1/" ?

I'm actually trying to do npm install winston-fluent from https://github.com/sakamoto-san/winston-fluent

Which depends on msgpack, and when its building msgpack, I get the error:

c:\projects\myapp\node_modules\winston-fluent\node_modules\fluent-logger\node_modules\msgpack\deps\msgpack\msgpack\type/tr1/unordered_map.hpp(22) : fatal error C1083: Cannot open include file: 'tr1/unordered_map': No such file or directory (..\..\..\deps\msgpack\object.cpp) [c:\projects\myapp\node_modules\winston-fluent\node_modules\fluent-logger\node_modules\msgpack\build\deps\msgpack\libmsgpack.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\app\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:\\app\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\projects\myapp\node_modules\winston-fluent\node_modules\fluent-logger\node_modules\msgpack
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! msgpack@0.2.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the msgpack@0.2.2 install script.
npm ERR! This is most likely a problem with the msgpack package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
htaox commented 10 years ago

Can you try this?

  1. Get the repo git clone https://github.com/msgpack/msgpack-node
  2. Make the following changes C:\downloadFolder\msgpack-node\deps\msgpack\msgpack\type\tr1\unordered_map.hpp Change:

    include <tr1/unordered_map>

    To:

    include <unordered_map>

C:\downloadFolder\msgpack-node\deps\msgpack\msgpack\type\tr1\unordered_set.hpp Change:

include <tr1/unordered_set>

To:

include <unordered_set>

  1. Open "Windows SDK 7.1 Command Prompt"
  2. Set the compile environment SetEnv /Release /x64
  3. Install cd C:\downloadFolder\msgpack-node

npm install

danielabar commented 10 years ago

Thanks for the reply. Here's what I ended up doing, because I was trying to use winston-fluent, which depends on fluent-logger, which in turn depends on msgpack:

And now it works. Thanks for your help :-)

godsflaw commented 10 years ago

I will happily take pull requests that fix the issue without breaking other ports.

htaox commented 10 years ago

I submitted pull request #16. Thanks.

willyg302 commented 10 years ago

Could #16 be merged and pushed to npm? Same issue currently breaking npm install zerorpc for me, ran through the steps above and it worked.

godsflaw commented 10 years ago

All merged up, version bumped, tagged, pushed to all mirrored repos, and published to npm. Thanks for the fix @htaox!