xorbit / node-aes-gcm

AES GCM module for node.js using OpenSSL
MIT License
34 stars 16 forks source link

Error building on windows #1

Closed nmalcolm closed 10 years ago

nmalcolm commented 10 years ago

Hi,

I'm not a C++ developer, nor a Windows user, so unfortunately I'm not able to debug this myself. The build works like magic on Linux.

Firstly I received an error stating it couldn't find OpenSSL -- simple enough to fix. I did have to use Visual Studio 2010 to get to the point where the error wouldn't show as I needed to include the OpenSSL library which Windows couldn't find.

I then received the following error:

..\src\node-aes-gcm.cc(213): error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'void (__cdecl *)(v8::Handle<T>)'

And this is where I cannot proceed.

Other information:

OS: Windows 7 64bit node-aes-gcm: 0.1.3 I'm using node-webkit and nw-gyp build to build. (This shouldn't be related to the problem)

Any help/pointers would be appreciated.

xorbit commented 10 years ago

Thank you for using my project and I'm sorry I didn't get back to you sooner, I was traveling.

I have to admit that before now I had never tried to build the project on Windows. I had copied the gyp configuration from another node module that uses OpenSSL and hoped it would work. So I just gave it a try on Windows to see what happens. Here are the steps I took:

Then I ran npm install node-eas-gcm:

C:\Users\xorbit\Projects\node-tests>npm install node-aes-gcm
npm http GET https://registry.npmjs.org/node-aes-gcm
npm http 304 https://registry.npmjs.org/node-aes-gcm

> node-aes-gcm@0.1.3 install C:\Users\xorbit\Projects\node-tests\node_modules\no
de-aes-gcm
> node-gyp rebuild

C:\Users\xorbit\Projects\node-tests\node_modules\node-aes-gcm>node "C:\Program F
iles\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\n
ode-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
  node-aes-gcm.cc
..\src\node-aes-gcm.cc(68): warning C4267: 'argument' : conversion from 'size_t
' to 'int32_t', possible loss of data [C:\Users\xorbit\Projects\node-tests\node
_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(114): warning C4267: 'argument' : conversion from 'size_
t' to 'int', possible loss of data [C:\Users\xorbit\Projects\node-tests\node_mo
dules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(118): warning C4267: 'argument' : conversion from 'size_
t' to 'int', possible loss of data [C:\Users\xorbit\Projects\node-tests\node_mo
dules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(183): warning C4267: 'argument' : conversion from 'size_
t' to 'int', possible loss of data [C:\Users\xorbit\Projects\node-tests\node_mo
dules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(187): warning C4267: 'argument' : conversion from 'size_
t' to 'int', possible loss of data [C:\Users\xorbit\Projects\node-tests\node_mo
dules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(189): warning C4800: 'int' : forcing value to bool 'true
' or 'false' (performance warning) [C:\Users\xorbit\Projects\node-tests\node_mo
dules\node-aes-gcm\build\node_aes_gcm.vcxproj]
C:\Users\xorbit\.node-gyp\0.10.24\deps\v8\include\v8.h(184): warning C4506: no
definition for inline function 'v8::Persistent<v8::Object> v8::Persistent<v8::O
bject>::New(v8::Handle<v8::Object>)' [C:\Users\xorbit\Projects\node-tests\node_
modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
     Creating library C:\Users\xorbit\Projects\node-tests\node_modules\node-aes
  -gcm\build\Release\node_aes_gcm.lib and object C:\Users\xorbit\Projects\node-
  tests\node_modules\node-aes-gcm\build\Release\node_aes_gcm.exp
  Generating code
  Finished generating code
  node_aes_gcm.vcxproj -> C:\Users\xorbit\Projects\node-tests\node_modules\node
  -aes-gcm\build\Release\\node_aes_gcm.node
node-aes-gcm@0.1.3 node_modules\node-aes-gcm

C:\Users\xorbit\Projects\node-tests>

So aside of some warnings (which I should look into), it seemed to work. I ran the node REPL and tried to encrypt and decrypt some stuff and that seemed to work too.

Is this what you were trying to do? Do these pointers help in any way?

nmalcolm commented 10 years ago

That looks similar to what I had tried -- I'll give it another go and see what happens. :)

nmalcolm commented 10 years ago

5 hours later and I've managed to compile successfully. I had to specify the visual studio version (http://www.kevgriffin.com/specifying-visual-studio-version-in-npm-installs/) when installing to get it to work.

Unfortunately it doesn't seem to want to execute when called.

Uncaught Error: %1 is not a valid Win32 application.
C:\Users\foo\AppData\Local\Temp\nw1992_12213\node_modules\node-aes-gcm\build\Release\node_aes_gcm.node
xorbit commented 10 years ago

I wish I had some idea why it doesn't work, or how to reproduce your problem. In your original message you mention node-webkit and nw-gyp build. Can you explain how this is involved? The project is set up to use node-gyp. I don't know about nw-gyp or what it is supposed to do.

nmalcolm commented 10 years ago

After a lot of research, reinstalling, testing, it seems the issue is not with node-aes-gcm but with node-webkit.

Reference: https://github.com/rogerwang/node-webkit/issues/199

After renaming my executable the encryption works fine. I guess I'll have to wait and see if it gets fixed but for now I can just edit my build script for Windows. :)

xorbit commented 10 years ago

Great, thanks for letting me know!