0rpc/zerorpc-node

Compile errors / Can't install package

bitnom opened this issue · 10 comments

package.json:

{
  "name": "pretty-calculator",
  "version": "1.0.0",
  "description": "A minimal Electron and Python - based calculator ",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  },
  "repository": "https://github.com/fyears/electron-python-example",
  "keywords": [
    "Electron",
    "Python",
    "zerorpc",
    "demo"
  ],
  "author": "fyears",
  "license": "MIT",
  "dependencies": {
    "zerorpc": "^0.9.8"
  },
  "devDependencies": {
    "electron": "^1.7.6",
    "electron-packager": "^9.0.1"
  }
}

npm i

../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<Object> buf = batch->Get(i).As<Object>();
                                       ^
In file included from ../binding.cc:24:0:
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3713:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^~~
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3713:43: note:   candidate expects 2 arguments, 1 provided
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3716:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^~~
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3716:43: note:   candidate expects 2 arguments, 1 provided
../binding.cc:1295:50: error: expected primary-expression before ‘>’ token
       Local<Object> buf = batch->Get(i).As<Object>();
                                                  ^
../binding.cc:1295:52: error: expected primary-expression before ‘)’ token
       Local<Object> buf = batch->Get(i).As<Object>();
                                                    ^
../binding.cc:1296:48: error: no matching function for call to ‘v8::Array::Get(uint32_t)’
       Local<Number> flagsObj = batch->Get(i + 1).As<Number>();
                                                ^
In file included from ../binding.cc:24:0:
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3713:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^~~
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3713:43: note:   candidate expects 2 arguments, 1 provided
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3716:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)
   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                           ^~~
/home/user/.cache/node-gyp/14.5.0/include/node/v8.h:3716:43: note:   candidate expects 2 arguments, 1 provided
../binding.cc:1296:59: error: expected primary-expression before ‘>’ token
       Local<Number> flagsObj = batch->Get(i + 1).As<Number>();
                                                           ^
../binding.cc:1296:61: error: expected primary-expression before ‘)’ token
       Local<Number> flagsObj = batch->Get(i + 1).As<Number>();
                                                             ^
zmq.target.mk:111: recipe for target 'Release/obj.target/zmq/binding.o' failed
make: *** [Release/obj.target/zmq/binding.o] Error 1
make: Leaving directory '/home/user/Code/python/electron-python-example/node_modules/zeromq/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/user/.nvm/versions/node/v14.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-42-generic
gyp ERR! command "/home/user/.nvm/versions/node/v14.5.0/bin/node" "/home/user/.nvm/versions/node/v14.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/user/Code/python/electron-python-example/node_modules/zeromq
gyp ERR! node -v v14.5.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zeromq@4.6.0 install: `node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zeromq@4.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2020-08-12T01_33_17_461Z-debug.log

Ubuntu 18.04
node v14.5.0
python --version: 2.7.17

Hey, I am facing the same exact issue on an Amazon Linux. Did you manage to get past this issue?

Facing same issue on Amazon Linux.

Currently it doesn't compile with node versions > 12. So if it is an option for you downgrade to node 12 LTS and it should compile.

It looks like this is an issue with upstream ZeroMQ, rather than with ZeroRPC directly, right? To confirm: are you able to successfully install/load ZeroMQ?

If that is in fact the issue, I imagine it would be fixed by updating the (rather outdated) ZMQ dependency, which is underway in #111

I have the same issue (albeit with more updated systems: macOS 11.0.1 and Node v14.17.1). zeromq 5.x.x successfully installs with npm install (as do all other dependencies), I have successfully installed ZeroMQ on my system (via homebrew), and the python endpoint of zerorpc works. The problems seems to be that zeromq 4.x.x is incompatible with more up-do-date libzmq builds.

Do you happen to know if the current code for zerorpc is compatible with the zeromq 5.x.x APIs? I think it would solve the problem if it was.

Hmm. I am seeing the same exact problem in the simple zerorpc install.
npm install zerorpc (fails)

Can someone help me here please?

If this is still unresolved, can someone recommend what I need to roll back or work arounds?

Log snippet:

timing reify:rollback:createSparse Completed in 25ms
75 timing reify:rollback:retireShallow Completed in 0ms
76 timing command:install Completed in 2391ms
77 verbose stack Error: command failed
77 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
77 verbose stack     at ChildProcess.emit (node:events:390:28)
77 verbose stack     at maybeClose (node:internal/child_process:1062:16)
77 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
78 verbose pkgid zmq@2.15.3

Platform info:

verbose Linux 5.11.0-43-generic
81 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "zmq"
82 verbose node v17.3.0
83 verbose npm  v8.3.0
84 error code 1
85 error path /usr/lib/node_modules/zmq
86 error command failed
87 error command sh -c node-gyp rebuild
88 error make: Entering directory '/usr/lib/node_modules/zmq/build'
88 error   CXX(target) Release/obj.target/zmq/binding.o
88 error make: Leaving directory '/usr/lib/node_modules/zmq/build'
89 error gyp info it worked if it ends with ok
89 error gyp info using node-gyp@8.4.1
89 error gyp info using node@17.3.0 | linux | x64
89 error gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
89 error gyp info spawn /usr/bin/python3
89 error gyp info spawn args [
89 error gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
89 error gyp info spawn args   'binding.gyp',
89 error gyp info spawn args   '-f',
89 error gyp info spawn args   'make',
89 error gyp info spawn args   '-I',
                                     

Towards the end of the npm install log file


89 error /root/.cache/node-gyp/17.3.0/include/node/v8-object.h:244:37: note:   candidate expects 3 arguments, 2 provided
89 error /root/.cache/node-gyp/17.3.0/include/node/v8-object.h:247:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
89 error   247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
89 error       |                                     ^~~
89 error /root/.cache/node-gyp/17.3.0/include/node/v8-object.h:247:37: note:   candidate expects 3 arguments, 2 provided
89 error make: *** [zmq.target.mk:113: Release/obj.target/zmq/binding.o] Error 1
89 error gyp ERR! build error
89 error gyp ERR! stack Error: `make` failed with exit code: 2
89 error gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
89 error gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
89 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
89 error gyp ERR! System Linux 5.11.0-43-generic
89 error gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
89 error gyp ERR! cwd /usr/lib/node_modules/zmq
89 error gyp ERR! node -v v17.3.0
89 error gyp ERR! node-gyp -v v8.4.1
89 error gyp ERR! not ok
90 verbose exit 1
91 timing npm Completed in 2623ms

The following command worked:

npm install zeromq@5

up to date, audited 158 packages in 991ms

but followed by
npm install zerorpc fails

@fpammer

#113 (comment)

What are the options if we can not revert to node 12 version.

I may have a lead: forcing zeromq twith Yarn resolutions, in package.json:

    "resolutions": {
        "**/mkdirp": "0.5.1",
        "**/react-dev-utils": "7.0.5",
        "**/react-docgen": "4.1.1",
        "**/commander": "7.2.0",
        "**/fs-extra": "9.1.0",
        "**/react": "16.9.0",
        "**/zeromq": "5.2.8"
    }

Basically build zeromq on your own, and then force Zerorpc to use this version.

Then I hit an issue with Webpack: zeromq/zeromq.js#384

Having the exact same problem after upgrading Node-gyp, so then I tried downgrading NodeJS to 12 LTS and the problem still persists. I've been working at this for weeks and still can't find a solution. I have every version of VS from 2015 up installed with the desktop build tools, zeromq installs perfectly fine, its just zerorpc giving me consistent issues, even on different machines.