ThirdPinion
11Jun/142

Node-Gyp on OSX

If you have Xcode installed on your Apple laptop, then you should have gotten a C++ compiler in the form of CLang.  You'd think this would work fine with Node-Gyp...and it does.  With a tweak.

Add something like this to the "targets" section of the binding.gyp file:


"xcode_settings": {
"GCC_ENABLE_CPP_RTTI": "YES",
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"OTHER_CPLUSPLUSFLAGS":["-stdlib=libc++"],
"OTHER_LDFLAGS":["-stdlib=libc++"],
"CLANG_CXX_LANGUAGE_STANDARD":"c++11",
"MACOSX_DEPLOYMENT_TARGET":"10.7"
}

Otherwise you'll probably get a litany of errors like

"cannot use typeid with -fno-rtti"

and

"cannot use 'throw' with exceptions disabled"

by Tagged as: , , 2 Comments