node_pcap icon indicating copy to clipboard operation
node_pcap copied to clipboard

Removed pcap.h which was leading to a compilation failure on Windows 7

Open ujjwalt opened this issue 10 years ago • 9 comments

Fixes #76

ujjwalt avatar Oct 16 '13 08:10 ujjwalt

I remember a couple more files that needed to be added on top of it. I will get around to listing them in a bit.

jtenner avatar Oct 16 '13 18:10 jtenner

@jtenner Any further updates?

ujjwalt avatar Oct 21 '13 19:10 ujjwalt

I will try it when I get home later. As I stated before, I think there are a few more includes that break it.

jtenner avatar Oct 21 '13 19:10 jtenner

C:\Users\jtenner\Desktop\Node-Webkit\curryJS>npm install pcap -g
npm http GET https://registry.npmjs.org/pcap
npm http 304 https://registry.npmjs.org/pcap
npm http GET https://registry.npmjs.org/socketwatcher
npm http 304 https://registry.npmjs.org/socketwatcher

> [email protected] install C:\Users\jtenner\AppData\Roaming\npm\node_modules\
pcap\node_modules\socketwatcher
> node-gyp rebuild


C:\Users\jtenner\AppData\Roaming\npm\node_modules\pcap\node_modules\socketwatche
r>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo
dules\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.
  socket_watcher.cpp
C:\Users\jtenner\.node-gyp\0.10.17\deps\v8\include\v8.h(218): warning C4506: no
 definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::H
andle<T>)' [C:\Users\jtenner\AppData\Roaming\npm\node_modules\pcap\node_modules
\socketwatcher\build\socketwatcher.vcxproj]
          with
          [
              T=v8::Object
          ]
     Creating library C:\Users\jtenner\AppData\Roaming\npm\node_modules\pcap\no
  de_modules\socketwatcher\build\Release\socketwatcher.lib and object C:\Users\
  jtenner\AppData\Roaming\npm\node_modules\pcap\node_modules\socketwatcher\buil
  d\Release\socketwatcher.exp
  Generating code
  Finished generating code
  socketwatcher.vcxproj -> C:\Users\jtenner\AppData\Roaming\npm\node_modules\pc
  ap\node_modules\socketwatcher\build\Release\\socketwatcher.node

> [email protected] install C:\Users\jtenner\AppData\Roaming\npm\node_modules\pcap
> node-gyp rebuild


C:\Users\jtenner\AppData\Roaming\npm\node_modules\pcap>node "C:\Program Files\no
dejs\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.
  pcap_binding.cc
  pcap_session.cc
..\pcap_binding.cc(5): fatal error C1083: Cannot open include file: 'pcap/pcap.
h': No such file or directory [C:\Users\jtenner\AppData\Roaming\npm\node_module
s\pcap\build\pcap_binding.vcxproj]
..\pcap_session.cc(4): fatal error C1083: Cannot open include file: 'pcap/pcap.
h': No such file or directory [C:\Users\jtenner\AppData\Roaming\npm\node_module
s\pcap\build\pcap_binding.vcxproj]
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:789:
12)
gyp ERR! System Windows_NT 6.1.7601
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\jtenner\AppData\Roaming\npm\node_modules\pcap
gyp ERR! node -v v0.10.17
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0

jtenner avatar Oct 22 '13 13:10 jtenner

That was the output for a global install for later reference.

I'll do a git pull from the windows7 branch to test the install.

jtenner avatar Oct 22 '13 13:10 jtenner

..\pcap_session.cc(4): fatal error C1083: Cannot open include file: 'pcap/pcap.
h': No such file or directory [C:\Users\jtenner\Desktop\Node-Webkit\Test_Pcap\n
ode_modules\pcap\build\pcap_binding.vcxproj]
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc [C:\Users\jtenner\Desktop\Node-Webkit\Test_Pcap\node_modules\pcap
\build\pcap_binding.vcxproj]
..\pcap_binding.cc(11): fatal error C1083: Cannot open include file: 'sys/time.
h': No such file or directory [C:\Users\jtenner\Desktop\Node-Webkit\Test_Pcap\n
ode_modules\pcap\build\pcap_binding.vcxproj]

Here you go.

{
  "name": "Test_Pcap",
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies":{
    "pcap":"git://github.com/mranney/node_pcap.git#windows7"
  },
  "author": "",
  "license": "BSD-2-Clause"
}

jtenner avatar Oct 22 '13 14:10 jtenner

Removing these references is not going to compile the code...

..maybe we need a copy of these header files to be included in the windows version?

jtenner avatar Oct 22 '13 14:10 jtenner

I think there's a lot more work needed to make node_pcap work on windows. We might need to bind to WinPcap. Let me have a look. Let me know if you have some ideas.

ujjwalt avatar Oct 25 '13 03:10 ujjwalt

My sentiment exactly. I won't be able to help you on this one unfortunately. My knowledge of C++ is quite limited.

jtenner avatar Oct 25 '13 13:10 jtenner