ddopson / node-segfault-handler

Tool for debugging native Node.js modules and getting stack traces when things go wrong.
BSD 3-Clause "New" or "Revised" License
319 stars 74 forks source link

backport to node0.10 by using more of Nan #64

Closed Matt-Esch closed 5 years ago

Matt-Esch commented 5 years ago

Node 0.10 support appears to be dropped after v1.0.0 despite this module using nan. I'm trying to upgrade a codebase that's currently running on 0.10 but I need this module to work on both targets. This is my attempt at using nan almost exclusively where possible. Hopefully this will aid with adding support for future versions too. Note also that the callback signature in libuv is different between 0.x and 1.x, hence the version checks.

kneth commented 5 years ago

@Matt-Esch Thank you for the contribution. I hope to have some time later this week to take a closer look.

kneth commented 5 years ago

@Matt-Esch When compiling on macOS using clang/Xcode, I get the error:

clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)

Which operating system/compiler did you use?

Matt-Esch commented 5 years ago

I'm using OSX and Xcode (Mojave 10.14.5 / Apple LLVM version 10.0.0 (clang-1000.11.45.5))

This change shouldn't make a difference to the basic compilation options. Which version of node are you testing with? If you're testing this with backcompat for node0.10 and using npm v2 or earlier, there is an issue with npm that sets the min version to 10.5, and support has long since been dropped. This can be resolved without upgrading npm by overriding the compiler flags:

export LDFLAGS="-mmacosx-version-min=10.9"
export CXXFLAGS="-mmacosx-version-min=10.9"
kneth commented 5 years ago

@Matt-Esch Adding 'MACOSX_DEPLOYMENT_TARGET': '10.9', to the xcode_settings is doing the trick (see #66).