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

Fails to build under Node 12 #61

Closed legraphista closed 5 years ago

legraphista commented 5 years ago
error /tmp/test/node_modules/segfault-handler: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /tmp/test/node_modules/segfault-handler
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@12.2.0 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/test/node_modules/segfault-handler/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/stefan/.node-gyp/12.2.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/stefan/.node-gyp/12.2.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/stefan/.node-gyp/12.2.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/test/node_modules/segfault-handler',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 14 ]
make: Entering directory '/tmp/test/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
../src/segfault-handler.cpp:86:25: error: expected ‘)’ before ‘<’ token
   callback_helper(Handle<Function> func) {
                         ^
../src/segfault-handler.cpp: In static member function ‘static void callback_helper::make_callback(uv_async_t*)’:
../src/segfault-handler.cpp:152:67: warning: ‘static v8::Local<v8::String> v8::String::NewFromUtf8(v8::Isolate*, const char*, v8::String::NewStringType, int)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       argStack->Set(i, String::NewFromUtf8(isolate, args->stack[i]));
                                                                   ^
In file included from /home/stefan/.node-gyp/12.2.0/include/node/v8-internal.h:14:0,
                 from /home/stefan/.node-gyp/12.2.0/include/node/v8.h:25,
                 from /home/stefan/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/segfault-handler.cpp:2:
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:2892:21: note: declared here
       Local<String> NewFromUtf8(Isolate* isolate, const char* data,
                     ^
/home/stefan/.node-gyp/12.2.0/include/node/v8config.h:307:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/segfault-handler.cpp:152:68: warning: ‘bool v8::Object::Set(uint32_t, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       argStack->Set(i, String::NewFromUtf8(isolate, args->stack[i]));
                                                                    ^
In file included from /home/stefan/.node-gyp/12.2.0/include/node/v8-internal.h:14:0,
                 from /home/stefan/.node-gyp/12.2.0/include/node/v8.h:25,
                 from /home/stefan/.node-gyp/12.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/segfault-handler.cpp:2:
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:3368:26: note: declared here
                     bool Set(uint32_t index, Local<Value> value));
                          ^
/home/stefan/.node-gyp/12.2.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/segfault-handler.cpp:159:105: error: no matching function for call to ‘v8::Function::Call(v8::Local<v8::Object>, int, v8::Local<v8::Value> [3])’
     Local<Function>::New(isolate, *args->callback)->Call(isolate->GetCurrentContext()->Global(), 3, argv);
                                                                                                         ^
In file included from /home/stefan/.node-gyp/12.2.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../src/segfault-handler.cpp:2:
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:4148:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context,
                                           ^~~~
/home/stefan/.node-gyp/12.2.0/include/node/v8.h:4148:43: note:   candidate expects 4 arguments, 3 provided
../src/segfault-handler.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE RegisterHandler(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/segfault-handler.cpp:314:40: error: ‘Handle’ was not declared in this scope
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                        ^~~~~~
../src/segfault-handler.cpp:314:40: note: suggested alternative: ‘rand_r’
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                        ^~~~~~
                                        rand_r
../src/segfault-handler.cpp:314:55: error: expected primary-expression before ‘>’ token
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                                       ^
../src/segfault-handler.cpp:314:58: error: ‘::Cast’ has not been declared
         callback = new callback_helper(Handle<Function>::Cast(info[i]));
                                                          ^~~~
make: *** [segfault-handler.target.mk:111: Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1
make: Leaving directory '/tmp/test/node_modules/segfault-handler/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:257:12)
gyp ERR! System Linux 5.0.0-13-generic
gyp ERR! command "/home/stefan/.nvm/versions/node/v12.2.0/bin/node" "/home/stefan/.nvm/versions/node/v12.2.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/test/node_modules/segfault-handler
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
kneth commented 5 years ago

I think the issue is that the version of NaN we are using, doesn't support node 12. It has been added (see https://github.com/nodejs/nan/commit/e512f920d89aa2e8f5fffd35376e66508ffebf54) but not yet released.

kneth commented 5 years ago

@legraphista In #62 I have added some support for node 12 - please try it out.

legraphista commented 5 years ago

We were in the process of migrating to node 12. I've noticed other packages with similar building issues, but after updating them (and to the latest nan), they have compiled without any issues using nan@2.13.2 The commit you're referencing looks to be Doc/CI related. I believe the actual support exists in 2.13.2 Here's an example of such migration i've seen https://github.com/Automattic/node-canvas/commit/39821964adff605a64890ceb44b8bf6514044c61

legraphista commented 5 years ago

I've checked the new branch, it builds :tada: I've also tested it with the current version of nan on npm, and it builds as well

kneth commented 5 years ago

Thank you for the info. I'll update my PR accordingly.

kneth commented 5 years ago

I will do a release during the upcoming weekend when I have had a chance to get rid of the warnings :smile: