GeoIP
GeoIP copied to clipboard
Build fails on Windows 7
Here's the output from npm:
C:\temp>npm install geoip
npm http GET https://registry.npmjs.org/geoip
npm http 304 https://registry.npmjs.org/geoip
> [email protected] install C:\temp\node_modules\geoip
> node-gyp rebuild
C:\temp\node_modules\geoip>node "C:\Program Files\nodejs\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.
C:\temp\node_modules\geoip\build\binding.sln : Solution file error MSB5004: The solution file has two projects named "geoip".
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:784:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\temp\node_modules\geoip
gyp ERR! node -v v0.10.4
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the geoip 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 geoip
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "geoip"
npm ERR! cwd C:\temp
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\temp\npm-debug.log
npm ERR! not ok code 0
@magicalhobo
Thanks for report, let me take a look.
@magicalhobo
Sorry, I have not virtual studio installed, os, it is quite difficult for me to testing that.
Can you install other node c++ addon ? such as ws?
Yes, ws and other C++ modules install fine for me. I have node-gyp working on my machine.
I know it's difficult if you don't have the environment setup, so let me know if there's anything I can try to get you more information.
@magicalhobo
Can you clone the repo and do make rebuild at the root, then post the result here?
I think the closest thing that makes sense in Windows would be
SET NODE_ENV=test & node-gyp rebuild
Which gives this output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn python
gyp info spawn args [ 'C:\\Users\\Sean\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'D:\\geoip\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\Sean\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\Sean\\.node-gyp\\0.10.4\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\Sean\\.node-gyp\\0.10.4',
gyp info spawn args '-Dmodule_root_dir=D:\\geoip',
gyp info spawn args '--depth=.',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\\geoip\\build',
gyp info spawn args '-Goutput_dir=.' ]
module.js:340
throw err;
^
Error: Cannot find module 'nan'
at Function.Module._resolveFilename (module.js:338:15)
at Function.require.resolve (module.js:384:19)
at [eval]:1:33
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:532:25)
at startup (node.js:80:7)
at node.js:901:3
gyp: Call to 'node -p -e "require('path').dirname(require.resolve('nan'))"' returned exit status 8. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\Sean\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:424:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Users\\Sean\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\geoip
gyp ERR! node -v v0.10.4
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
@magicalhobo
You need install npm module nan first, I think.
C:\temp\node_modules\geoip\build\binding.sln : Solution file error MSB5004: The solution file has two projects named "geoip".
This because the libgeoip target name is also "geoip". Then node-gyp is creating a solution file (binding.sln) containing two projetcs with same name. But even after fixing this by renaming the target name from "geoip" to "libgeoip" the build fails while compiling libgeoip (node-gyp is using MVS compiler to build libgeoip). To skip this issue I'm using a MinGW/Msys libgeoip build. So I have removed the libgeoip from the dependency list. But now the the build fails while compiling the geoip module:
D:\Node-new\GeoIP>npm install
[email protected] install D:\Node-new\GeoIP node-gyp rebuild
D:\Node-new\GeoIP>node "C:\Program Files (x86)\nodejs\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.
city6.cc
country.cc
country6.cc
city.cc
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\city.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
init.cc
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\country.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
region.cc
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\country6.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
netspeed.cc
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\city6.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
org.cc
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\init.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
utils.cc
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\region.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
global.cc
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\netspeed.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\org.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
d:\node-new\geoip\src\init.h(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory (..\src\utils.cc) [D:\Node-new\GeoIP\build\geoip.vcxproj]
C:\Users\sumo.node-gyp\0.10.22\deps\v8\include\v8.h(179): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handle<T>)' [D:\Node-new\GeoIP\build\geoip.vc
xproj]
with
T=v8::Object
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 (x86)\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 (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Node-new\GeoIP
gyp ERR! node -v v0.10.22
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the geoip 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 geoip
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd D:\Node-new\GeoIP
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\Node-new\GeoIP\npm-debug.log
npm ERR! not ok code 0
D:\Node-new\GeoIP>
Despites the project name bug, Microsoft Visual Studio doesn't supports C99 extension (they are still developing this in MVS2013). For instance: Error 1 error C2057: expected constant expression .\GeoIP\src\city6.cc 72 1 geoip Error 2 error C2466: cannot allocate an array of constant size 0 .\GeoIP\src\city6.cc 72 1 geoip
@kingsumos
why c99 ?, this module is mainly wrote in c++, it's just call libgeoip's functions.
Although the module is in C++ it its using some features from C99, for instance variable-length arrays: char host_cstr[host_str->Length() + 1]; Visual Studio still doesn't supports variable-length arrays...
@kingsumos
Thanks for your clarifications.
Just figured I'd add a tip: http://www.appveyor.com/ offers free windows-based CI testing, like Travis does for real operating systems.
I would really like to see this on Windows