Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added support for "node-gyp" build #17

Closed
wants to merge 5 commits into
from

Conversation

Projects
None yet
5 participants
Contributor

TooTallNate commented Feb 8, 2012

Hey @brianmcd! So I've added a bindings.gyp file which is compatible with node-gyp, since node-waf is removed in node v0.8.x. So this essentially adds Windows support and ensures forwards compatibility. Cheers!

This was referenced Feb 8, 2012

Owner

brianmcd commented Feb 8, 2012

Thanks! I've been following the thread on the Node mailing list and was planning on looking into this this weekend.

Is there a way to specify a target architecture for node-gyp build? On my 64 bit system (Ubuntu 11.04) on node 0.6.10:

brianmcd@home:~/projects/contextify$ node-gyp clean
info it worked if it ends with ok 
info done ok 

brianmcd@home:~/projects/contextify$ node-gyp configure
info it worked if it ends with ok 
spawn python [ '/home/brianmcd/.node-gyp/0.6/tools/gyp_addon',
  '-f',
  'make',
  '--suffix',
  '.gyp' ]
info done ok 

brianmcd@home:~/projects/contextify$ node-gyp build
info it worked if it ends with ok 
spawn make [ 'BUILDTYPE=Release', '-f', 'Makefile.gyp' ]
  CXX(target) out/Release/obj.target/contextify/src/contextify.o
In file included from /usr/include/features.h:388:0,
                 from /usr/include/stdint.h:26,
                 from /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include/stdint.h:3,
                 from ../../.node-gyp/0.6/deps/uv/include/uv.h:54,
                 from ../../.node-gyp/0.6/src/node.h:61,
                 from src/contextify.cc:1:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
compilation terminated.
make: *** [out/Release/obj.target/contextify/src/contextify.o] Error 1
ERR! `make` failed with exit code: 2
ERR! not ok

This is with node-gyp installed locally in contextify/node_modules, if that matters.

Contributor

TooTallNate commented Feb 8, 2012

So I'm guessing that gyp is adding the -m32 flag to g++. You can run node-gyp build -v to see the verbose output including the full g++ command that gets invoked. I think to fix it you can specify the target_arch in your gyp file, setting it to x64. Give that a shot!

Owner

brianmcd commented Feb 8, 2012

Thanks for the help. You were right about gyp adding -m32. I got things working by making bindings.gyp look like:

{
  'variables' : {
    'target_arch': 'x64'
  },
  'targets': [
    {   
      'target_name': 'contextify',
      'sources': [ 'src/contextify.cc' ],
      'cflags': ['-fPIC']
    }   
  ]
}

I had to add -fPIC to cflags or else I got this output:

brianmcd@home:~/projects/contextify$ node-gyp build -v
info it worked if it ends with ok 
verb command 'build' [] 
verb build args [] 
verb `which` succeededmake '/usr/bin/make' 
spawn make [ 'V=1', 'BUILDTYPE=Release', '-f', 'Makefile.gyp' ]
  g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DNDEBUG' -I../../.node-gyp/0.6/src -I../../.node-gyp/0.6/deps/uv/include -I../../.node-gyp/0.6/deps/v8/include -Wall -pthread -ansi -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -fno-rtti -fno-exceptions -MMD -MF out/Release/.deps/out/Release/obj.target/contextify/src/contextify.o.d.raw  -c -o out/Release/obj.target/contextify/src/contextify.o src/contextify.cc
  flock out/Release/linker.lock g++ -shared -pthread -rdynamic   -Wl,-soname=contextify.node -o out/Release/obj.target/contextify.node -Wl,--start-group out/Release/obj.target/contextify/src/contextify.o -Wl,--end-group 
/usr/bin/ld: out/Release/obj.target/contextify/src/contextify.o: relocation R_X86_64_32 against `node::ObjectWrap::WeakCallback(v8::Persistent<v8::Value>, void*)' can not be used when making a shared object; recompile with -fPIC
out/Release/obj.target/contextify/src/contextify.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [out/Release/obj.target/contextify.node] Error 1
ERR! `make` failed with exit code: 2
ERR! not ok

Should these things be made defaults in node-gyp (setting target_arch to the user's current architecture, and adding -fPIC for gcc builds)?

Contributor

TooTallNate commented Feb 8, 2012

These may indeed be good defaults. Thanks for the suggestion, I'll look into it.

Owner

brianmcd commented Feb 9, 2012

Landed, thanks!

@brianmcd brianmcd closed this Feb 9, 2012

Contributor

TooTallNate commented Feb 10, 2012

@brianmcd fyi, as of node-gyp@0.0.3, both -fPIC and the current node version's architecture are the defaults, so it should "Just Work" now. Let me know if you run into any troubles.

I don't know if this is the place, but I'm getting an error trying to install contextify using node-gyp.

Platform: Windows 7, node 0.6.7, npm 1.1.0-beta-10


$ node-gyp configure
info it worked if it ends with ok
info downloading: http://nodejs.org/dist/v0.6.7/node-v0.6.7.tar.gz
info downloading `node.lib` http://nodejs.org/dist/v0.6.7/node.lib
ERR! Error: 404 status code downloading node.lib
    at Request._callback (C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\lib\install.js:268:27)
    at Request.callback (C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\node_modules\request\main.js:119:22)
    at Request.<anonymous> (C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\node_modules\request\main.js:525:16)
    at Request.emit (events.js:88:20)
    at IncomingMessage.<anonymous> (C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\node_modules\request\main.js:484:14)
    at IncomingMessage.emit (events.js:88:20)
    at HTTPParser.onMessageComplete (http.js:137:23)
    at Socket.ondata (http.js:1137:24)
    at TCP.onread (net.js:354:27)
ERR! not ok

Contributor

TooTallNate commented Mar 13, 2012

Upgrade to v0.612

On Tuesday, March 13, 2012, Benjamn Eidelman <
reply@reply.github.com>
wrote:

I don't know if this is the place, but I'm getting an error trying to
install contextify using node-gyp.

Platform: Windows 7, node 0.6.7, npm 1.1.0-beta-10


$ node-gyp configure
info it worked if it ends with ok
info downloading: http://nodejs.org/dist/v0.6.7/node-v0.6.7.tar.gz
info downloading `node.lib` http://nodejs.org/dist/v0.6.7/node.lib
ERR! Error: 404 status code downloading node.lib
   at Request._callback
(C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\lib\install.js:268:27)
   at Request.callback
(C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\node_modules\request\main.js:119:22)
   at Request.<anonymous>
(C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\node_modules\request\main.js:525:16)
   at Request.emit (events.js:88:20)
   at IncomingMessage.<anonymous>
(C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\node_modules\request\main.js:484:14)
   at IncomingMessage.emit (events.js:88:20)
   at HTTPParser.onMessageComplete (http.js:137:23)
   at Socket.ondata (http.js:1137:24)
   at TCP.onread (net.js:354:27)
ERR! not ok


Reply to this email directly or view it on GitHub:
#17 (comment)

ops, you were right! now I'm installing python :), regards!

configure now works fine, but I'm getting an error build, stdin.h file not found... This might be a very silly error I can't understand as I'm totally ignorant on C/C++


D:\........\contextify>node-gyp build
info it worked if it ends with ok
spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe [ 'build/binding.sln',
  '/clp:Verbosity=minimal',
  '/nologo',
  '/p:Configuration=Release;Platform=Win32' ]
C:\Users\benjamine\.node-gyp\0.6.12\deps\uv\include\uv.h(54): fatal error C1083: Cannot open in
clude file: 'stdint.h': No such file or directory [D:\node\piropirozombie\node_modules\contexti
fy\build\binding.sln]
Project : warning PRJ0018: The following environment variables were not found: [D:\node\piropir
ozombie\node_modules\contextify\build\binding.sln]
ERR! Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
    at Array.0 (C:\Users\benjamine\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:160:25)
    at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok

Contributor

TooTallNate commented Mar 13, 2012

Do you have Visual Studio 2010 installed? Apparently 2008 and below don't include stdint.h or something bizzarre like that.

Actually I have both installed, notice that it's using .Net 4.0 msbuild. As a Visual Studio developer I'm used to MS bizarreness :), I can try to invoke an specific msbuild version to test.

Contributor

TooTallNate commented Mar 13, 2012

@benjamine try invoking the configure step like this (I'm trying to test something):

$ node-gyp configure -- -f msvs -G msvs_version=2010

looks like that did the trick!


D:\node\piropirozombie\node_modules\contextify>node-gyp build
info it worked if it ends with ok
spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe [ 'build/binding.sln',
  '/clp:Verbosity=minimal',
  '/nologo',
  '/p:Configuration=Release;Platform=Win32' ]
  contextify.cc
C:\Users\benjamine\.node-gyp\0.6.12\src\node_object_wrap.h(57): warning C4251: 'node::ObjectWra
p::handle_' : class 'v8::Persistent<T>' needs to have dll-interface to be used by clients of cl
ass 'node::ObjectWrap' [D:\node\piropirozombie\node_modules\contextify\build\contextify.vcxproj
]
          with
          [
              T=v8::Object
          ]
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ excep
tion handler used, but unwind semantics are not enabled. Specify /EHsc [D:\node\piropirozombie\
node_modules\contextify\build\contextify.vcxproj]
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012:
 TargetPath(D:\node\piropirozombie\node_modules\contextify\build\Release\contextify.dll) does n
ot match the Linker's OutputFile property value (D:\node\piropirozombie\node_modules\contextify
\build\Release\contextify.node). This may cause your project to build incorrectly. To correct t
his, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the
value specified in %(Link.OutputFile). [D:\node\piropirozombie\node_modules\contextify\build\co
ntextify.vcxproj]
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012:
 TargetExt(.dll) does not match the Linker's OutputFile property value (.node). This may cause
your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetNa
me) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [D:\node\
piropirozombie\node_modules\contextify\build\contextify.vcxproj]
     Creating library D:\node\piropirozombie\node_modules\contextify\build\Release\contextify.l
  ib and object D:\node\piropirozombie\node_modules\contextify\build\Release\contextify.exp
  Generating code
  Finished generating code
  contextify.vcxproj -> D:\node\piropirozombie\node_modules\contextify\build\Release\contextify
  .dll
info done ok

Owner

brianmcd commented Mar 14, 2012

Thanks for helping with this, @tootallnate !

From the comments above, I installed Visual Studio C++ 2010, and Python 2.7.2

I am running into the following error:

C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8>node-gyp build
info it worked if it ends with ok
spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe [ 'build/binding.sln',
  '/clp:Verbosity=minimal',
  '/nologo',
  '/p:Configuration=Release;Platform=Win32' ]
  contextify.cc
C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\.node-gyp\0.6.7\src\node_object_wrap.h(57): warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persisten
t' needs to have dll-interface to be used by clients of class 'node::ObjectWrap' [C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj
]
          with
          [
              T=v8::Object
          ]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\Hugh\Downloads\br
ianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4
ae8\build\Release\contextify.dll) does not match the Linker's OutputFile property value (C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\Release\contex
tify.node). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.Outp
utFile). [C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012: TargetExt(.dll) does not match the Linker's OutputFile property value (.node). This may cause you
r project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [C:\Users\Hugh\Downlo
ads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\.node-gyp\0.6.7\Release\node.lib : fatal error LNK1107: invalid or corrupt file: cannot read at 0xA2 [C:\User
s\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
ERR! Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
    at Array.0 (C:\Users\Hugh\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:176:25)
    at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok

I'm unfamiliar with these things, if anyone has any suggestions I would greatly appreciate it.

Contributor

TooTallNate commented Mar 21, 2012

@hughlomas I haven't seen that one before. Looks like your dev file node.lib file is corrupt somehow. Try running node-gyp install to reinstall that (also maybe update to the latest node-gyp version if not already).

Then, what happens if you just type in npm install contextify (you need the latest version of npm). It works for me:

Administrator@NATHAN-90D06B0E ~
$ npm install contextify
npm http GET https://registry.npmjs.org/contextify
npm http 200 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> contextify@0.1.2 install C:\Documents and Settings\Administrator\node_modules\contextify
> node-gyp rebuild


C:\Documents and Settings\Administrator\node_modules\contextify>node "c:\Documents and Settings\Administrator\Applicatio
n Data\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
info it worked if it ends with ok
spawn python [ 'C:\\Documents and Settings\\Administrator\\.node-gyp\\0.6.12\\tools\\gyp_addon',
  'binding.gyp',
  '-IC:\\Documents and Settings\\Administrator\\node_modules\\contextify\\build\\config.gypi' ]
spawn C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe [ 'build/binding.sln',
  '/clp:Verbosity=minimal',
  '/nologo',
  '/p:Configuration=Release;Platform=Win32' ]
  contextify.cc
C:\Documents and Settings\Administrator\.node-gyp\0.6.12\src\node_object_wrap.h(57): warning C4251: 'node::ObjectWrap::
handle_' : class 'v8::Persistent<T>' needs to have dll-interface to be used by clients of class 'node::ObjectWrap' [C:\
Documents and Settings\Administrator\node_modules\contextify\build\contextify.vcxproj]
          with
          [
              T=v8::Object
          ]
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, but u
nwind semantics are not enabled. Specify /EHsc [C:\Documents and Settings\Administrator\node_modules\contextify\build\c
ontextify.vcxproj]
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\Documents
 and Settings\Administrator\node_modules\contextify\build\Release\contextify.dll) does not match the Linker's OutputFil
e property value (C:\Documents and Settings\Administrator\node_modules\contextify\build\Release\contextify.node). This
may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(Targ
etExt) property values match the value specified in %(Link.OutputFile). [C:\Documents and Settings\Administrator\node_m
odules\contextify\build\contextify.vcxproj]
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012: TargetExt(.dll) does no
t match the Linker's OutputFile property value (.node). This may cause your project to build incorrectly. To correct th
is, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link
.OutputFile). [C:\Documents and Settings\Administrator\node_modules\contextify\build\contextify.vcxproj]
     Creating library C:\Documents and Settings\Administrator\node_modules\contextify\build\Release\contextify.lib and
  object C:\Documents and Settings\Administrator\node_modules\contextify\build\Release\contextify.exp
  Generating code
  Finished generating code
  contextify.vcxproj -> C:\Documents and Settings\Administrator\node_modules\contextify\build\Release\contextify.dll
info done ok
contextify@0.1.2 ./node_modules/contextify
└── bindings@0.3.0

Administrator@NATHAN-90D06B0E ~
$ node
> require('contextify')
[Function: Contextify]

Using node-gyp@0.3.7 and npm -v says 1.1.0-beta-10

Deleted the .node-gyp directory, and did node-gyp install:

C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8>node-gyp install
info it worked if it ends with ok
info downloading: http://nodejs.org/dist/v0.6.7/node-v0.6.7.tar.gz
info downloading: http://nodejs.org/dist/v0.6.7/node.lib
0.6.7
info done ok

then typing npm install contextify:

C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8>npm install contextify


C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8>

No output whatsoever.

Not sure if this helps but also node-gyp rebuild:

C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8>node-gyp rebuild
info it worked if it ends with ok
spawn C:\Python27\python.exe [ 'C:\\Users\\Hugh\\Downloads\\brianmcd-contextify-v0.1.2-0-g9ed4ae8\\brianmcd-contextify-9ed4ae8\\.node-gyp\\0.6.7\\tools\\gyp_addon',
  'binding.gyp',
  '-IC:\\Users\\Hugh\\Downloads\\brianmcd-contextify-v0.1.2-0-g9ed4ae8\\brianmcd-contextify-9ed4ae8\\build\\config.gypi',
  '-f',
  'msvs',
  '-G',
  'msvs_version=2010' ]
spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe [ 'build/binding.sln',
  '/clp:Verbosity=minimal',
  '/nologo',
  '/p:Configuration=Release;Platform=Win32' ]
  contextify.cc
C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\.node-gyp\0.6.7\src\node_object_wrap.h(57): warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persisten
t' needs to have dll-interface to be used by clients of class 'node::ObjectWrap' [C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj
]
          with
          [
              T=v8::Object
          ]
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\Hugh\Downloads\br
ianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4
ae8\build\Release\contextify.dll) does not match the Linker's OutputFile property value (C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\Release\contex
tify.node). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.Outp
utFile). [C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012: TargetExt(.dll) does not match the Linker's OutputFile property value (.node). This may cause you
r project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [C:\Users\Hugh\Downlo
ads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
C:\Users\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\.node-gyp\0.6.7\Release\node.lib : fatal error LNK1107: invalid or corrupt file: cannot read at 0xA2 [C:\User
s\Hugh\Downloads\brianmcd-contextify-v0.1.2-0-g9ed4ae8\brianmcd-contextify-9ed4ae8\build\contextify.vcxproj]
ERR! Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
    at Array.0 (C:\Users\Hugh\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:176:25)
    at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok
Contributor

TooTallNate commented Mar 22, 2012

@hughlomas That's an older version of npm. Try updating:

$ npm install -g npm
C:\Users\Hugh\Downloads\contextify>npm install -g npm
npm http GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/-/npm-1.1.10.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.1.10.tgz
C:\Users\Hugh\AppData\Roaming\npm\npm -> C:\Users\Hugh\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm@1.1.10 C:\Users\Hugh\AppData\Roaming\npm\node_modules\npm

C:\Users\Hugh\Downloads\contextify>npm -v
1.1.0-beta-10

edit: nevermind, I just downloaded the source from https://github.com/isaacs/npm/ and copy-pasted it to replace my npm directory, that seems to have worked, now at 1.1.10

C:\hugh\army>npm install contextify
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> contextify@0.1.2 install C:\hugh\army\node_modules\contextify
> node-gyp rebuild


C:\hugh\army\node_modules\contextify>node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
info it worked if it ends with ok
info downloading: http://nodejs.org/dist/v0.6.7/node-v0.6.7.tar.gz
info downloading `node.lib` http://nodejs.org/dist/v0.6.7/node.lib
spawn C:\Python27\python.exe [ 'C:\\Users\\Hugh\\.node-gyp\\0.6.7\\tools\\gyp_addon',
  'binding.gyp',
  '-IC:\\hugh\\army\\node_modules\\contextify\\build\\config.gypi',
  '-f',
  'msvs',
  '-G',
  'msvs_version=2010' ]
spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe [ 'build/binding.sln',
  '/clp:Verbosity=minimal',
  '/nologo',
  '/p:Configuration=Release;Platform=Win32' ]
  contextify.cc
C:\Users\Hugh\.node-gyp\0.6.7\src\node_object_wrap.h(57): warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent' needs to have dll-interface to be used by clients of class 'node::Obje
ctWrap' [C:\hugh\army\node_modules\contextify\build\contextify.vcxproj]
          with
          [
              T=v8::Object
          ]
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\hugh\army\node_modules\
contextify\build\contextify.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\hugh\army\node_modules\contextify\build\Release\contextify.dll) does not match the
Linker's OutputFile property value (C:\hugh\army\node_modules\contextify\build\Release\contextify.node). This may cause your project to build incorrectly. To correct this, please make sure that $(Out
Dir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [C:\hugh\army\node_modules\contextify\build\contextify.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012: TargetExt(.dll) does not match the Linker's OutputFile property value (.node). This may cause you
r project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [C:\hugh\army\node_mo
dules\contextify\build\contextify.vcxproj]
C:\Users\Hugh\.node-gyp\0.6.7\Release\node.lib : fatal error LNK1107: invalid or corrupt file: cannot read at 0xA2 [C:\hugh\army\node_modules\contextify\build\contextify.vcxproj]
ERR! Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
    at Array.0 (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:169:25)
    at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok

npm ERR! contextify@0.1.2 install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the contextify@0.1.2 install script.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "contextify"
npm ERR! cwd C:\hugh\army
npm ERR! node -v v0.6.7
npm ERR! npm -v 1.1.10
npm ERR! code ELIFECYCLE
npm ERR! message contextify@0.1.2 install: `node-gyp rebuild`
npm ERR! message `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\hugh\army\npm-debug.log
npm not ok

Well I should have checked earlier, but based on the part of the error that says the invalid file is C:\Users\Hugh\.node-gyp\0.6.7\Release\node.lib, I opened the file up in Notepad++ and this is the result:

<title>404 Not Found</title>

404 Not Found


nginx

which is the response from http://nodejs.org/dist/v0.6.7/node.lib, which appears in the error log above when it says info downloadingnode.libhttp://nodejs.org/dist/v0.6.7/node.lib

Contributor

TooTallNate commented Mar 23, 2012

@hughlomas Ahhh yes, you hadn't told us your node version. I should have thought of that. You need to upgrade to node v0.6.10 or newer. See TooTallNate/node-gyp#43.

Phew, finally worked! Thanks very much for your assistance.

@tootallnate The suggestion you gave to @brianmcd didnt work for me. I use Node 0.10.4. But I found a workaround

node-gyp clean configure build --verbose --arch=x64

I wonder why passing arguments in command line is not documented anywhere (atleast, it is difficult for even google to find). I had to go through the code completely to figure this out. Please let me know, if you need someone to document it. I would be happy to do that. :)

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