Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails at node-gyp rebuild on Windows #33

Open
Brigadier1-9 opened this issue Feb 19, 2016 · 8 comments
Open

Install fails at node-gyp rebuild on Windows #33

Brigadier1-9 opened this issue Feb 19, 2016 · 8 comments

Comments

@Brigadier1-9
Copy link

My issue is that 'npm install dv' fails on Windows 10 with VS2013.
The error displayed is:
npm ERR! [email protected] install:node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. <snip>

If you watch the compiler output or check the logs you see:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h(4774): error C3861: '__uncaught_exception': identifier not found (..\..\..\deps\opencv\modules\core\src\parallel.cpp) [C:\Development\temp1\node_modules\dv\build\deps \opencv\libopencv.vcxproj]

I've had a dig and suspect the issue is actually coming from node-gyp; the pre-processor options in the vcxproj files generated by node-gyp include the '_HAS_EXCEPTIONS=0' flag (in pre-processor options) which, according to Microsoft, is an undocumented option that is evil and should not be used (OK, I'm oversimplifying here - see https://connect.microsoft.com/VisualStudio/feedback/details/811347/compiling-vc-12-0-with-has-exceptions-0-and-including-concrt-h-causes-a-compiler-error)

This option tells the compiler the code has no exception handling, and then causes issues with exception macros like '__uncaught_exception'

I can find no obvious option in the dv gyp files that would be responsible for putting that option in, and am almost at the limit of my node-gyp knowledge....
However, I have managed to fix this in dv by changing common.gyp to remove the _HAS_EXCEPTIONS=0 using a 'defines!' (undefine):

....['OS=="win"',
{ 'defines!' : [ '_HAS_EXCEPTIONS=0' ],
'configurations': {....

In theory, it may be better to define this only in the opencv.gyp, as that is the only module that causes this error, but I didn't for several reasons:

  1. If the option is undocumented and shouldn't be used, then switching it off for the entire build seems better to me
  2. common.gyp already has a 'OS=="win"' conditional section, and I'm lazy
  3. I have spent far too much time on this already (although I have learnt a lot!)

I don't have access to other build windows environment combinations (only one Windows dev PC here, the others are OSX or Linux) so I can't easily do proper testing on combinations of node-gyp/msvc/msbuild etc, so reluctant to issue a pull request - just throwing this out there to see if it helps others with the same problem.

After making the change to common.gyp, I can issue a 'node-gyp rebuild' and then an 'npm test' and they all pass.
My versions:
Node: 4.2.1
Node-gyp: 3.3.0 (I installed this with -g so I could manually run node-gyp configure and check the generated project files)
Visual Studio: 12.0.40629.00 Update 5

Brigadier1-9 added a commit to Brigadier1-9/node-dv that referenced this issue Feb 19, 2016
@rashfael
Copy link
Contributor

Got CI with appveyor to run and could reproduce this error.

@denysvitali
Copy link

A branch has been merged, is the issue fixed?

@orkideh
Copy link

orkideh commented Jul 5, 2016

I am trying to install on windows 10 x64 almost same error.
VS last version community , node 5.11.1 , npm 3.8.6. I attached my logfile

npm-debug.txt

@Brigadier1-9
Copy link
Author

Hi!

I've had a quick look at your debug and I think you are getting further than I was, so you may have a different problem. The issue is that the 'Failed at node-gyp rebuild' is such a generic error that it could be almost anything.

I actually wound up installing node-gyp (npm install -g node-gyp) then cloned the repository with git clone (somewhere outside of your node project) in order to run 'node gyp configure' then 'node gyp build' by hand; that then revealed the exact error (which, unless I am missing it, I can't see in your debug.txt)

When it compiles you can then npm install (folder path) from your node project.

If it helps any, I have a pre-fixed branch - feel free to clone that one instead.

@orkideh
Copy link

orkideh commented Jul 6, 2016

Hi,
Very interesting last night i was play with code to make it work.
I download all source and compile with node-gyp configure and node-gyp build, then i return to parent folder and try to install with npm install dv and it works after that.
Without doubt this way is wrong to make it work but i guess i fixed something accidentally.

@Brigadier1-9
Copy link
Author

Brigadier1-9 commented Jul 6, 2016

Very weird, but as long as it works!

There is an error in the Zxing barcode reader that we’ve just discovered too by the way – it’s a memory leak and it crashes after parsing a number of images. We have a fix, I’ll open a new issue for it shortly.

@orkideh
Copy link

orkideh commented Jul 6, 2016

Thank you very much

@kneumei
Copy link

kneumei commented Jul 6, 2016

@Brigadier1-9 FWIW, your fork fixed by build issue as well.

win 10 x64, node 6.2.1, npm 3.9.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants