Building node contextify using Visual Studio 2013 - node.js

I'm attempting to get "contextify" to build on my machine. It is a Windows 10 machine.
I am using Windows 10
I have Visual Studio 2013 Professional installed.
I have python 2.7.10, and it's in my PATH.
I have node 4.1.2 32 bit installed (I had previously tried with 64 bit, which is the default that the node website wanted me to download, but it appears to make no difference).
I've got no idea what the right sequence of steps should be, I don't know anything about node-gyp, npm etc, I'm just trying to build a project that has a dependency on contextify.
I've done a clone of the contextify repo from git hub and naively run
`npm install'. I'm using a Visual Studio command prompt (either VS2013 x64 Native Tools Command Prompt or VS2013 x86 Native Tools Command Prompt, makes no difference).
What I get is this:
d:\work\contextify>npm install
> contextify#0.1.14 install d:\work\contextify
> node-gyp rebuild
d:\work\contextify>if not defined npm_config_node_gyp (node "C:\Users\tomq\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
contextify.cc
d:\work\contextify\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)' : function te
mplate has already been defined [d:\work\contextify\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(256) : see declaration of '_NanEnsureLocal'
d:\work\contextify\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type
[d:\work\contextify\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(661): error C2039: 'FreeCallback' : is not a member of 'node' [d:\work\contex
tify\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(661): error C2061: syntax error : identifier 'FreeCallback' [d:\work\contexti
fy\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(665): error C2065: 'callback' : undeclared identifier [d:\work\contextify\bui
ld\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(665): error C2065: 'hint' : undeclared identifier [d:\work\contextify\build\c
ontextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New' : none of the 4 overloads could conver
t all the argument types [d:\work\contextify\build\contextify.vcxproj]
C:\Users\tomq\.node-gyp\4.1.2\include\node\node_buffer.h(43): could be 'v8::MaybeLocal<v8::Object> node::Buff
er::New(v8::Isolate *,char *,size_t)'
C:\Users\tomq\.node-gyp\4.1.2\include\node\node_buffer.h(31): or 'v8::MaybeLocal<v8::Object> node::Buff
er::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
while trying to match the argument list '(v8::Isolate *, const char *, uint32_t)'
d:\work\contextify\node_modules\nan\nan.h(676): error C2664: 'v8::Local<v8::Object>::Local(const v8::Local<v8::Object>
&)' : cannot convert argument 1 from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' [d:\work\contextif
y\build\contextify.vcxproj]
Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object>'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be cal
led
d:\work\contextify\node_modules\nan\nan.h(683): error C2039: 'Use' : is not a member of 'node::Buffer' [d:\work\context
ify\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found [d:\work\contextify\build\cont
extify.vcxproj]
I have read the Contextify Windows Install Guide, but it doesn't really help me. I have read many other posts as well.
Am I supposed to be able to get this to compile using Visual Studio 2013?
Thanks.

I've got same issue.
I've solved this problem.
Contextify is not supported in node 4.x.
So I've downgrade node to 0.10.x, then works fine.
Alyosha.

Related

Can't compile rust program

I'm new to rust and made a simple rust program(hello world). I installed rust and Visual Studio from here - https://visualstudio.microsoft.com/downloads/ and restarted the device. However when I type in rustc <path> on command prompt, I get:
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015 or VS 2017 was installed with the Visual C++ option
error: aborting due to previous error
What's wrong?
Update
I updated my system path to include C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.22.27905\bin\Hostx64\x64, but now it gives this error:
error: linking with `link.exe` failed: exit code: 1181
|
= note: "link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "main.main.7rcbfp3g-cgu.0.rcgu.o" "main.main.7rcbfp3g-cgu.1.rcgu.o" "main.main.7rcbfp3g-cgu.2.rcgu.o" "main.main.7rcbfp3g-cgu.3.rcgu.o" "main.main.7rcbfp3g-cgu.4.rcgu.o" "main.main.7rcbfp3g-cgu.5.rcgu.o" "/OUT:main.exe" "main.4s37gsrti678ik8u.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-b2f27b8d08c4688f.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-9c73c9c2e052b2f1.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libbacktrace-7a588e8fa018f6bc.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-74b71f441b8acffe.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-42efce06651eab9c.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-7518db6030684168.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-f7edde5930d50b47.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-30189c8e78e151e8.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-5f5719f1cab83a12.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-f297c401e81b90c6.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-f8c80c1aefab6a32.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-6d66b6e58725d3ed.rlib" "C:\\Users\\Sid\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-1f6a73e107798f53.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
= note: LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'
error: aborting due to previous error
This reports your exact problem.
So the solution seems to use VS installer and installing C++ for Desktop Module.
Use of rustup is a matter of convenience but shouldn't be mandatory.

node-gyp rebuild fails installing stanford-corenlp on Windows 7

There are quite a few similar threads, which I thoroughly worked through this weekend, none of which contained the answer to my problem.
Installing the node package stanford-corenlp by calling
npm install stanford-corenlp
fails on my Windows 7 machine with the error output containing
npm ERR! Failed at the java#0.2.9 install script 'node-gyp rebuild'.
The first error displayed is:
child_process: customFds option is deprecated, use stdio instead.
This error ist followed by a few warnings and then hundreds of errors like these:
f:\appdata\roaming\npm\node_modules\stanford-corenlp\node_modules\java\src\java.h(10): error C2039: 'ObjectWrap' : is not a member of 'node' (..\src\java.cpp) [f:\AppData\Roaming\npm\node_modules\stanford-corenlp\node_modules\java\build\nodejavabridge_bindings.vcxproj]
f:\appdata\roaming\npm\node_modules\stanford-corenlp\node_modules\java\src\java.h(10): error C2504: 'ObjectWrap' : base class undefined (..\src\java.cpp) [f:\AppData\Roaming\npm\node_modules\stanford-corenlp\node_modules\java\build\nodejavabridge_bindings.vcxproj]
f:\appdata\roaming\npm\node_modules\stanford-corenlp\node_modules\java\src\java.h(23): error C2039: 'Arguments' : is not a member of 'v8' (..\src\java.cpp) [f:\AppData\Roaming\npm\node_modules\stanford-corenlp\node_modules\java\build\nodejavabridge_bindings.vcxproj]
f:\appdata\roaming\npm\node_modules\stanford-corenlp\node_modules\java\src\java.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (..\src\java.cpp) [f:\AppData\Roaming\npm\node_modules\stanford-corenlp\node_modules\java\build\nodejavabridge_bindings.vcxproj]
f:\appdata\roaming\npm\node_modules\stanford-corenlp\node_modules\java\src\java.h(23): error C2143: syntax error : missing ',' before '&' (..\src\java.cpp) [f:\AppData\Roaming\npm\node_modules\stanford-corenlp\node_modules\java\build\nodejavabridge_bindings.vcxproj]
...
..\src\java.cpp(43): error C2819: type 'v8::Persistent<T>' does not have an overloaded member 'operator ->'
..\src\java.cpp(43): error C2039: 'InstanceTemplate' : is not a member of 'v8::Persistent<T>'
..\src\java.cpp(43): error C2227: left of '->SetInternalFieldCount' must pointto class/struct/union/generic type
..\src\java.cpp(44): error C2819: type 'v8::Persistent<T>' does not have an overloaded member 'operator ->'
..\src\java.cpp(44): error C2039: 'SetClassName' : is not a member of 'v8::Persistent<T>'
..\src\java.cpp(44): error C2039: 'NewSymbol' : is not a member of 'v8::String'
..\src\java.cpp(44): error C3861: 'NewSymbol': identifier not found
..\src\java.cpp(46): error C2664: 'node::NODE_SET_PROTOTYPE_METHOD' : cannot convert parameter 1 from 'v8::Persistent<T>' to 'v8::Handle<T>'
...
At the moment I have 32-bit versions of, Python, Java-SDK and node.js installed and environment variables set. (I started with 64-bit versions with the same result.)
I installed the Visual Studio 2012 Express version.
I tried the Windows SDK version 8.1.
I tried calling the npm call from the SDK 6.1 (2008) command prompt.
I tried .NET 3.5 and 4.5.
I tried adding the
--msvs_version=2012
option to the npm call.
I tried updating node-gyp with
npm install node-gyp#latest
I would be grateful for any kind of input, especially the kind of input that makes me understand what is going on, so that I might figure out the solution by myself.
I think this should be related to node version. However I couldn't find .travis.yml file under stanford-corenlp so I have no clue of the min/max version it supports. I would recommend you to start with v10, then v8 and v6 to see if it works.
I guess this was related to the node modules java, the latest java#0.4.7 work's well. PS : I am the author of the node module stanford-corenlp.

Node.js npm installing websocket fails

I am installing websocket through npm in Windows 7 64 bit. The websocket version is 1.0.8
I am getting a linking error even though I have Visual Studio 2010 and Python 2.7 :
C:\Windows\system32\node_modules\websocket>node "C:\Program Files (x86)\nodejs\n
ode_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" r
ebuild
validation.cc
C:\Users\User\.node-gyp\0.10.30\deps\v8\include\v8.h(184): warning C4506: no d
efinition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Hand
le<T>)' [C:\Windows\system32\node_modules\websocket\build\validation.vcxproj]
with
[
T=v8::Object
]
LINK : fatal error LNK1104: cannot open file 'C:\Windows\system32\node_modules\w
ebsocket\build\Release\validation.node' [C:\Windows\system32\node_modules\websoc
ket\build\validation.vcxproj]
xor.cpp
C:\Users\User\.node-gyp\0.10.30\deps\v8\include\v8.h(179): warning C4506: no d
efinition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Hand
le<T>)' [C:\Windows\system32\node_modules\websocket\build\xor.vcxproj]
with
[
T=v8::Object
]
LINK : fatal error LNK1104: cannot open file 'C:\Windows\system32\node_modules\w
ebsocket\build\Release\xor.node' [C:\Windows\system32\node_modules\websocket\bui
ld\xor.vcxproj]
gyp[websocket v1.0.8]
Native code compile failed!!
Please note that this module DOES NOT REQUIRE the native components
and will still work without them, though not quite as efficiently.
On Windows, native extensions require Visual Studio and Python.
On Unix, native extensions require Python, make and a C++ compiler.
Start npm with --websocket:verbose to show compilation output (if any).
websocket#1.0.8 node_modules\websocket
C:\Windows\system32>
Is there a way to skip this compilation stuff and just use this module right away ? Or someway to fix this error ?
PS: the command prompt was started with Admin rights.

Installing v8-profiler using npm

While trying
npm install -g v8-profiler
I'm hitting the below errors:
..\graph_node.cc(99): error C2039: 'GetRetainersCount' : is not a member of 'v8::HeapGraphNode' [C:\Users\username\AppData\Roaming\npm\node_modules\v8
-profiler\build\profiler.vcxproj]
C:\Users\username\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(249) : see declaration of 'v8::HeapGraphNode'
..\graph_node.cc(132): error C2039: 'GetRetainedSize' : is not a member of 'v8::HeapGraphNode' [C:\Users\username\AppData\Roaming\npm\node_modules\v8-
profiler\build\profiler.vcxproj]
C:\Users\username\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(249) : see declaration of 'v8::HeapGraphNode'
..\graph_node.cc(154): error C2039: 'GetRetainer' : is not a member of 'v8::HeapGraphNode' [C:\Users\username\AppData\Roaming\npm\node_modules\v8-prof
iler\build\profiler.vcxproj]
C:\Users\username\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(249) : see declaration of 'v8::HeapGraphNode'
..\graph_node.cc(162): error C2039: 'GetDominatorNode' : is not a member of 'v8::HeapGraphNode' [C:\Users\username\AppData\Roaming\npm\node_modules\v8
-profiler\build\profiler.vcxproj]
C:\Users\username\.node-gyp\0.10.15\deps\v8\include\v8-profiler.h(249) : see declaration of 'v8::HeapGraphNode'
profiler.cc
Looks like a compilation issue. What might be wrong ?
My system has :
Visual Studio 2010
Windows SDK 7.1 Note: If you get error on installation, maybe this
link will help you.
Visual Studio 2010 SP1
Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
Python 2.7
As mentioned in : https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup
I just ran into this same issue. It looks like NodeFly's fork of v8-profiler contains the fix that Sean described, so I installed that version instead:
npm install nodefly-v8-profiler
According to this comment on GitHub, some APIs were removed from V8, and v8-profiler hasn't been updated.
It was V8 problem.
v8-profiler uses some V8 API's, but those API's are eliminated from V8 in version 3.11.5.
...
In order to use v8-profiler, simplest way is to remove the following
methods and SetAccessor call inside constructor from graph_node.cc and
rebuild v8-profiler.
GraphNode::GetRetainersCount
GraphNode::GetRetainedSize
GraphNode::GetRetainer
GraphNode::GetDominator
But of course, if you do this, you can't see anymore dominator and retainer informations.

WDK (Windows Driver Kit) and VC++ headers problem

I'm trying to read from an USB HID device, I know how to do it in C# using DLLImport hid.dll, but I want to do it from C++, this way I don't have to declare all the structures, etc, and just include the headers files.
So I downloaded the WDK and then when including the headers files and linking the libraries I'm getting a lot of errors:
#include <windows.h>
extern "C" {
#include <hidsdi.h>
}
int main(){
}
Errors (6 out of 163):
Error 1 error C2065: 'PASSIVE_LEVEL' : undeclared identifier c:\winddk\7600.16385.1\inc\api\hidpi.h 302 driver
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\winddk\7600.16385.1\inc\api\hidpi.h 303 driver
Error 3 error C2146: syntax error : missing ';' before identifier 'NTSTATUS' c:\winddk\7600.16385.1\inc\api\hidpi.h 303 driver
Error 4 error C2143: syntax error : missing ';' before '__stdcall' c:\winddk\7600.16385.1\inc\api\hidpi.h 303 driver
Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\winddk\7600.16385.1\inc\api\hidpi.h 303 driver
Error 6 error C2377: 'NTSTATUS' : redefinition; typedef cannot be overloaded with any other symbol c:\winddk\7600.16385.1\inc\api\hidpi.h 303 driver
OK so I read somewhere that I have to upgrade the Windows SDK too, I had the Microsoft Windows SDK v6.0A, I downloaded and installed the windows SDK v7.0. But then looks like I have two SDK now? How I properly do the SDK upgrade in visual studio?
I very much appreciate your help,
Thanks,
Carlos
I found a solution, don't know why this is working, but it is!:
In Visual Studio go to:
Tools->Options->Projects->VC++ Directories and then Show directories for: include files.
Add this folders:
C:\WinDDK\7600.16385.1\inc\ddk and C:\WinDDK\7600.16385.1\inc\api
Now here is the trick that solved the problem for me and I don't know why, because seems odd but here it is:
C:\WinDDK\7600.16385.1\inc\ddk -> This directory have to be the first directory in the list!
C:\WinDDK\7600.16385.1\inc\api -> This directory have to be ABOVE "$(WindowsSdkDir)\include" BUT BELOW "$(VCInstallDir)include"
Example:
C:\WinDDK\7600.16385.1\inc\ddk
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
C:\WinDDK\7600.16385.1\inc\api
$(WindowsSdkDir)\include
$(FrameworkSDKDir)include
Carlos

Resources