-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot rebuild zeromq due to module code incompatibilities #343
Comments
This doesn't work because of compile errors (which you didn't provide). This isn't the fault of electron-rebuild, but rather because of source code incompatibilities with the version of Node that's bundled with the latest stable version of Electron (Node 12 for Electron 7, for example). Here's an example of incompatibilities that happened with Electron 5 (although it doesn't seem like this is the problem here): https://electronjs.org/blog/nodejs-native-addons-and-electron-5 Compile errorsmake: Entering directory '/tmp/zero/node_modules/zeromq/build' CXX(target) Release/obj.target/zmq/binding.o In file included from $HOME/.electron-gyp/7.1.5/include/node/v8-internal.h:14, from $HOME/.electron-gyp/7.1.5/include/node/v8.h:27, from ../binding.cc:24: $HOME/.electron-gyp/7.1.5/include/node/v8config.h:343:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations] declarator __attribute__((deprecated(message))) ^ $HOME/.electron-gyp/7.1.5/include/node/v8.h:8513:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’ V8_DEPRECATE_SOON("Use *WithData version.", ^~~~~~~~~~~~~~~~~ $HOME/.electron-gyp/7.1.5/include/node/v8config.h:343:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations] declarator __attribute__((deprecated(message))) ^ $HOME/.electron-gyp/7.1.5/include/node/v8.h:8522:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’ V8_DEPRECATE_SOON("Use *WithData version.", ^~~~~~~~~~~~~~~~~ In file included from ../binding.cc:40: ../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’: ../../nan/nan.h:2298: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) ^ ../binding.cc: In member function ‘void zmq::Socket::NotifyReadReady()’: ../binding.cc:394:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 0, NULL); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc:394:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 0, NULL); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc: In member function ‘void zmq::Socket::NotifySendReady()’: ../binding.cc:402:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 0, NULL); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc:402:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 0, NULL); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc: In member function ‘void zmq::Socket::MonitorEvent(uint16_t, int32_t, char*)’: ../binding.cc:453:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 4, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc:453:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 4, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc: In member function ‘void zmq::Socket::MonitorError(const char*)’: ../binding.cc:468:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 1, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc:468:73: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(this->handle(), callback_v.As(), 1, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc: In static member function ‘static void zmq::Socket::UV_MonitorCallback(uv_timer_t*, int)’: ../binding.cc:540:98: warning: cast between incompatible function types from ‘void (*)(uv_timer_t*, int)’ {aka ‘void (*)(uv_timer_s*, int)’} to ‘uv_timer_cb’ {aka ‘void (*)(uv_timer_s*)’} [-Wcast-function-type] uv_timer_start(s->monitor_handle_, reinterpret_cast(Socket::UV_MonitorCallback), s->timer_interval_, 0); ^ ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Bind(Nan::NAN_METHOD_ARGS_TYPE)’: ../binding.cc:774:37: 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] (uv_after_work_cb)UV_BindAsyncAfter); ^~~~~~~~~~~~~~~~~ ../binding.cc: In static member function ‘static void zmq::Socket::UV_BindAsyncAfter(uv_work_t*)’: ../binding.cc:809:70: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc:809:70: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Unbind(Nan::NAN_METHOD_ARGS_TYPE)’: ../binding.cc:855:37: 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] (uv_after_work_cb)UV_UnbindAsyncAfter); ^~~~~~~~~~~~~~~~~~~ ../binding.cc: In static member function ‘static void zmq::Socket::UV_UnbindAsyncAfter(uv_work_t*)’: ../binding.cc:888:70: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc:888:70: warning: ‘v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)’ is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv); ^ In file included from ../binding.cc:40: ../../nan/nan.h:1024:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~~~~~~~~~ ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Monitor(Nan::NAN_METHOD_ARGS_TYPE)’: ../binding.cc:1057:103: warning: cast between incompatible function types from ‘void (*)(uv_timer_t*, int)’ {aka ‘void (*)(uv_timer_s*, int)’} to ‘uv_timer_cb’ {aka ‘void (*)(uv_timer_s*)’} [-Wcast-function-type] uv_timer_start(socket->monitor_handle_, reinterpret_cast(Socket::UV_MonitorCallback), timer_interval, 0); ^ ../binding.cc: In constructor ‘zmq::Socket::OutgoingMessage::BufferReference::BufferReference(v8::Local)’: ../binding.cc:1227:78: warning: cast between incompatible function types from ‘void (*)(uv_async_t*, int)’ {aka ‘void (*)(uv_async_s*, int)’} to ‘uv_async_cb’ {aka ‘void (*)(uv_async_s*)’} [-Wcast-function-type] uv_async_init(loop, &async, reinterpret_cast(cleanup)); ^ ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Sendv(Nan::NAN_METHOD_ARGS_TYPE)’: ../binding.cc:1295:39: error: no matching function for call to ‘v8::Array::Get(uint32_t&)’ Local buf = batch->Get(i).As(); ^ In file included from ../binding.cc:24: $HOME/.electron-gyp/7.1.5/include/node/v8.h:3502:43: note: candidate: ‘v8::MaybeLocal v8::Object::Get(v8::Local, v8::Local)’ V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context, ^~~ $HOME/.electron-gyp/7.1.5/include/node/v8.h:3502:43: note: candidate expects 2 arguments, 1 provided $HOME/.electron-gyp/7.1.5/include/node/v8.h:3505:43: note: candidate: ‘v8::MaybeLocal v8::Object::Get(v8::Local, uint32_t)’ V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context, ^~~ $HOME/.electron-gyp/7.1.5/include/node/v8.h:3505:43: note: candidate expects 2 arguments, 1 provided ../binding.cc:1295:50: error: expected primary-expression before ‘>’ token Local buf = batch->Get(i).As(); ^ ../binding.cc:1295:52: error: expected primary-expression before ‘)’ token Local buf = batch->Get(i).As(); ^ ../binding.cc:1296:48: error: no matching function for call to ‘v8::Array::Get(uint32_t)’ Local flagsObj = batch->Get(i + 1).As(); ^ In file included from ../binding.cc:24: $HOME/.electron-gyp/7.1.5/include/node/v8.h:3502:43: note: candidate: ‘v8::MaybeLocal v8::Object::Get(v8::Local, v8::Local)’ V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context, ^~~ $HOME/.electron-gyp/7.1.5/include/node/v8.h:3502:43: note: candidate expects 2 arguments, 1 provided $HOME/.electron-gyp/7.1.5/include/node/v8.h:3505:43: note: candidate: ‘v8::MaybeLocal v8::Object::Get(v8::Local, uint32_t)’ V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context, ^~~ $HOME/.electron-gyp/7.1.5/include/node/v8.h:3505:43: note: candidate expects 2 arguments, 1 provided ../binding.cc:1296:59: error: expected primary-expression before ‘>’ token Local flagsObj = batch->Get(i + 1).As(); ^ ../binding.cc:1296:61: error: expected primary-expression before ‘)’ token Local flagsObj = batch->Get(i + 1).As(); ^ In file included from ../binding.cc:25: ../binding.cc: At global scope: $HOME/.electron-gyp/7.1.5/include/node/node.h:572:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local, v8::Local, void*)’} [-Wcast-function-type] (node::addon_register_func) (regfunc), \ ^ $HOME/.electron-gyp/7.1.5/include/node/node.h:606:3: note: in expansion of macro ‘NODE_MODULE_X’ NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) ^~~~~~~~~~~~~ ../binding.cc:1610:1: note: in expansion of macro ‘NODE_MODULE’ NODE_MODULE(zmq, init) ^~~~~~~~~~~ In file included from ../binding.cc:24: $HOME/.electron-gyp/7.1.5/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P*, typename v8::WeakCallbackInfo |
@malept After two days researching this and documenting my results (above), can you please recommend where I and dozens of others can find a remedy to this? If its not electron-rebuild - is there a particular project where an issue can be raised? |
Seems like you need to use a version of If you need more assistance, please use one of the community forums. The issue tracker is meant for bugs / feature requests in electron-rebuild itself. |
Creating a new electron-forge project and installing zerorpc via npm works. Attempting an electron-rebuild however fails, with a node-gyp error. There are over a dozen unresolved questions about this problem (or slight variants) on the internet.
To reproduce:
Easy to reproduce, as you can see. The only solution I found was to switch to electron 3 by editing
package.json
and changing"electron": "7.1.5",
to"electron": "3",
thenrm -rf node_modules
,npm install
. Now running$(npm bin)/electron-rebuild
succeeds.Wading through the attempted solutions out there, I found nothing worked. I tried:
npm install -g node-gyp
npm install --save zeromq
npm install zeromq --build-from-source --save
sudo apt-get install libzmq3-dev
npm config set python /usr/bin/python2
node-gyp rebuild --python /usr/bin/python2
abi
stuff e.g.npm rebuild zeromq --runtime=electron --target=7.1.4 --abi=75
andnpm rebuild zeromq --runtime=electron --target=12.8.1 --abi=75
since there seems to be some confusion re whether target refers to electron or node. Tried different abi numbers e.g. 72. Often getting error downloading headers.npm rebuild zeromq --runtime=electron
cd node_modules/zeromq/
thenHOME=~/.electron-gyp node-gyp rebuild --target=7.1.4 --arch=x64 --dist-url=https://electronjs.org/headers
which actually compiles, but then runningnpm start
triggers a rebuild and fails.So now I'm on Electron 3.1.13 and everything works, but would like to be able to run later versions of Electron.
The text was updated successfully, but these errors were encountered: