node-gyp: error: exception handling disabled, use -fexceptions to enable
I’m trying to update zeromq.node to use gyp
as part of the process of getting it running on Windows (JustinTulloss/zeromq.node#81). I’m currently blocked by gyp
’s -fno-exceptions
default (I think), but will probably run into linking issues soon enough.
Here’s binding.gyp
:
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'cflags': ['-fexceptions'],
'cflags_cc': ['-fexceptions']
}
]
}
Here’s a transcript:
seth@lotus:~/src/JustinTulloss/zeromq.node [⚡ gyp] $ node-gyp configure --target=0.7
info it worked if it ends with ok
spawn python [ '/Users/seth/.node-gyp/0.7/tools/gyp_addon',
'-f',
'make',
'--suffix',
'.gyp',
'-I',
'/Users/seth/.node-gyp/0.7/tools/patch2722.gypi',
'-Dtarget_arch=x64' ]
info done ok
seth@lotus:~/src/JustinTulloss/zeromq.node [⚡ gyp] $ node-gyp build
info it worked if it ends with ok
spawn make [ 'BUILDTYPE=Release', '-f', 'Makefile.gyp' ]
CXX(target) out/Release/obj.target/binding/binding.o
binding.cc: In constructor ‘zmq::Context::Context(int)’:
binding.cc:185: error: exception handling disabled, use -fexceptions to enable
make: *** [out/Release/obj.target/binding/binding.o] Error 1
ERR! `make` failed with exit code: 2
ERR! not ok
About this issue
- Original URL
- State: closed
- Created 12 years ago
- Comments: 15 (9 by maintainers)
Commits related to this issue
- support macOS refs: https://gist.github.com/yinyin/2027912 https://github.com/nodejs/node-gyp/issues/17 — committed to liukun/equihashverify by liukun 6 years ago
- Fix build fail on MacOs 🍎 Update binding.gyp in order to fix node-gyp build on MacOs. Related Issue: https://github.com/nodejs/node-gyp/issues/17#issuecomment-3917672 — committed to pniewiejski/luhnjs by deleted user 4 years ago
- fix #1 `npm install` fails in linux, as reported in issue #1. Setting the flags as in this change fixes this problem by negating , as per the solution described in [this issue](https://github.co... — committed to mef/ngraph.louvain.native by mef 4 years ago
- fix #1 `npm install` fails in linux (debian 10 buster, node v12.13), as reported in issue anvaka#1. Setting the flags as in this change fixes this problem by negating the default flag - which dis... — committed to mef/ngraph.louvain.native by mef 4 years ago
@mojodna Ok so I just confirmed that this indeed enables C++ exceptions:
I’m gonna close, reopen if you’re still having troubles.
Here it is a more comprehensive list of flags to enable exceptions on all platforms builds:
Hey @mojodna. So the
-fno-exceptions
flag comes from node’scommon.gypi
file. The following is supposed to negate that, try adding:The
!
at the end is supposed to make sure that that flag is not used. Let me know if that works.The real solution however would be to remove all instances of C+±style
throw
statements. That’s what I did fornode-ffi
, but I’m sure that won’t be possible for every module.