jprichardson / node-kexec

Node.js exec function to replace running process; like Ruby's exec.
MIT License
50 stars 25 forks source link

Unable to build on node 12 #36

Open JohnnyCrazy opened 5 years ago

JohnnyCrazy commented 5 years ago

Build is currently broken with the new node 12 version.

I guess the important error is on this line:

../src/kexec.cc: At global scope:
../src/kexec.cc:19:11: error: ‘v8::Handle’ has not been declared
 using v8::Handle;
           ^~~~~~
Whole build output

```bash Directory: /home/johnny/projects/proxy_mgmt_cli/node_modules/kexec Output: gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@12.0.0 | linux | x64 gyp info spawn /usr/bin/python2 gyp info spawn args [ gyp info spawn args '/home/johnny/.asdf/installs/nodejs/12.0.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 '/home/johnny/projects/proxy_mgmt_cli/node_modules/kexec/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/home/johnny/.asdf/installs/nodejs/12.0.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/johnny/.node-gyp/12.0.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/johnny/.node-gyp/12.0.0', gyp info spawn args '-Dnode_gyp_dir=/home/johnny/.asdf/installs/nodejs/12.0.0/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/home/johnny/.node-gyp/12.0.0/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/home/johnny/projects/proxy_mgmt_cli/node_modules/kexec', 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' ] make: Entering directory '/home/johnny/projects/proxy_mgmt_cli/node_modules/kexec/build' CXX(target) Release/obj.target/kexec/src/kexec.o In file included from ../src/kexec.cc:14: ../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’: ../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type] , reinterpret_cast(AsyncExecuteComplete) ^ ../src/kexec.cc: At global scope: ../src/kexec.cc:19:11: error: ‘v8::Handle’ has not been declared using v8::Handle; ^~~~~~ ../src/kexec.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE kexec(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/kexec.cc:68:38: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local)’ String::Utf8Value str(info[0]); ^ In file included from /home/johnny/.node-gyp/12.0.0/include/node/node.h:63, from ../../nan/nan.h:53, from ../src/kexec.cc:14: /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2995:5: note: candidate: ‘v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local)’ Utf8Value(Isolate* isolate, Local obj); ^~~~~~~~~ /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided ../src/kexec.cc:78:38: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local)’ String::Utf8Value str(info[0]); ^ In file included from /home/johnny/.node-gyp/12.0.0/include/node/node.h:63, from ../../nan/nan.h:53, from ../src/kexec.cc:14: /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2995:5: note: candidate: ‘v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local)’ Utf8Value(Isolate* isolate, Local obj); ^~~~~~~~~ /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided ../src/kexec.cc:91:72: warning: ‘v8::Local v8::Object::Get(v8::Local)’ is deprecated: Use maybe version [-Wdeprecated-declarations] String::Utf8Value arg(argv_handle->Get(Nan::New(i))->ToString()); ^ In file included from /home/johnny/.node-gyp/12.0.0/include/node/v8-internal.h:14, from /home/johnny/.node-gyp/12.0.0/include/node/v8.h:25, from /home/johnny/.node-gyp/12.0.0/include/node/node.h:63, from ../../nan/nan.h:53, from ../src/kexec.cc:14: /home/johnny/.node-gyp/12.0.0/include/node/v8.h:3412:55: note: declared here V8_DEPRECATE_SOON("Use maybe version", Local Get(Local key)); ^~~ /home/johnny/.node-gyp/12.0.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’ declarator __attribute__((deprecated(message))) ^~~~~~~~~~ ../src/kexec.cc:91:84: error: no matching function for call to ‘v8::Value::ToString()’ String::Utf8Value arg(argv_handle->Get(Nan::New(i))->ToString()); ^ In file included from /home/johnny/.node-gyp/12.0.0/include/node/node.h:63, from ../../nan/nan.h:53, from ../src/kexec.cc:14: /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2528:44: note: candidate: ‘v8::MaybeLocal v8::Value::ToString(v8::Local) const’ V8_WARN_UNUSED_RESULT MaybeLocal ToString( ^~~~~~~~ /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2528:44: note: candidate expects 1 argument, 0 provided In file included from /home/johnny/.node-gyp/12.0.0/include/node/v8-internal.h:14, from /home/johnny/.node-gyp/12.0.0/include/node/v8.h:25, from /home/johnny/.node-gyp/12.0.0/include/node/node.h:63, from ../../nan/nan.h:53, from ../src/kexec.cc:14: /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2544:35: note: candidate: ‘v8::Local v8::Value::ToString(v8::Isolate*) const’ Local ToString(Isolate* isolate) const); ^~~~~~~~ /home/johnny/.node-gyp/12.0.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’ declarator __attribute__((deprecated(message))) ^~~~~~~~~~ /home/johnny/.node-gyp/12.0.0/include/node/v8.h:2544:35: note: candidate expects 1 argument, 0 provided Local ToString(Isolate* isolate) const); ^~~~~~~~ /home/johnny/.node-gyp/12.0.0/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’ declarator __attribute__((deprecated(message))) ^~~~~~~~~~ ../src/kexec.cc: At global scope: ../src/kexec.cc:115:12: error: variable or field ‘init’ declared void void init (Handle exports) { ^~~~~~ ../src/kexec.cc:115:12: error: ‘Handle’ was not declared in this scope ../src/kexec.cc:115:12: note: suggested alternative: ‘rand_r’ void init (Handle exports) { ^~~~~~ rand_r ../src/kexec.cc:115:25: error: expected primary-expression before ‘>’ token void init (Handle exports) { ^ ../src/kexec.cc:115:27: error: ‘exports’ was not declared in this scope void init (Handle exports) { ^~~~~~~ In file included from ../../nan/nan.h:53, from ../src/kexec.cc:14: ../src/kexec.cc:119:20: error: ‘init’ was not declared in this scope NODE_MODULE(kexec, init); ^~~~ /home/johnny/.node-gyp/12.0.0/include/node/node.h:556:36: note: in definition of macro ‘NODE_MODULE_X’ (node::addon_register_func) (regfunc), \ ^~~~~~~ ../src/kexec.cc:119:1: note: in expansion of macro ‘NODE_MODULE’ NODE_MODULE(kexec, init); ^~~~~~~~~~~ ../src/kexec.cc:119:20: note: suggested alternative: ‘int’ NODE_MODULE(kexec, init); ^~~~ /home/johnny/.node-gyp/12.0.0/include/node/node.h:556:36: note: in definition of macro ‘NODE_MODULE_X’ (node::addon_register_func) (regfunc), \ ^~~~~~~ ../src/kexec.cc:119:1: note: in expansion of macro ‘NODE_MODULE’ NODE_MODULE(kexec, init); ^~~~~~~~~~~ In file included from /home/johnny/.node-gyp/12.0.0/include/node/node.h:63, from ../../nan/nan.h:53, from ../src/kexec.cc:14: /home/johnny/.node-gyp/12.0.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P*, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void (*)(const v8::WeakCallbackInfo&)]’: /home/johnny/.node-gyp/12.0.0/include/node/node_object_wrap.h:84:78: required from here /home/johnny/.node-gyp/12.0.0/include/node/v8.h:9817:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] reinterpret_cast(callback), type); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/johnny/.node-gyp/12.0.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P*, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void (*)(const v8::WeakCallbackInfo&)]’: ../../nan/nan_object_wrap.h:65:61: required from here /home/johnny/.node-gyp/12.0.0/include/node/v8.h:9817:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] make: *** [kexec.target.mk:109: Release/obj.target/kexec/src/kexec.o] Error 1 make: Leaving directory '/home/johnny/projects/proxy_mgmt_cli/node_modules/kexec/build' gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/johnny/.asdf/installs/nodejs/12.0.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:256:12) gyp ERR! System Linux 5.0.4-arch1-1-ARCH gyp ERR! command "/home/johnny/.asdf/installs/nodejs/12.0.0/bin/node" "/home/johnny/.asdf/installs/nodejs/12.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/johnny/projects/proxy_mgmt_cli/node_modules/kexec gyp ERR! node -v v12.0.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok ```

Do you want to tackle this @jprichardson or are you more comfortable with a PR?

mitchellwills commented 4 years ago

It looks like there are a couple PRs out to fix this. Are there any plans to merge one of them?

jprichardson commented 4 years ago

I'm willing to give anyone access that wants to maintain this package.

tamlyn commented 4 years ago

In the meantime (if you're using Yarn), you can use a patched version from one of the open PRs by adding the following to your package.json:

  "resolutions": {
    "kexec": "meteor/node-kexec#update-for-node-12"
  }

npm doesn't natively support resolutions but I believe there's a way to fudge it. Bear in mind that if/when meteor delete their fork or branch your build will start failing so you may want to create your own fork.

i-am-al-x commented 3 years ago

Please, please, somebody accept the maintenance responsibility for this "node-kexec" package. It seems like the "meteor" people are doing the maintenance anyway; can't one of you just accept the package as your own?

I upgraded to Node 14 on an AWS linux platform, and now I am stuck. I can't build distributions because I can't update "webpack" because "node-gyp" can't build "kexec".

I guess I will have to downgrade to Node 11, for now. (I will first try the "resolutions" suggestion from @tamlyn, but I don't know how to "fudge it" with "npm".)

Help. Someone please assume new ownership of "node-kexec".

i-am-al-x commented 2 years ago

As mentioned in issue #37 (which is more-or-less a repeat of this issue #36), I guess we have to workaround it for now. Here is what I wrote in issue #37:

Here is a workaround that uses the Meteor rewrite, "kexec v4.0.0". https://stackoverflow.com/questions/70884111/fix-kexec-error-failure-problem-broken-that-prevents-unable-to-npm-inst/70884112#70884112 Of course, we would prefer that the rewrite gets pulled into the Master branch, but until then, I documented this workaround, which allowed me to use "npm install" so I could get WebPack working again.