cryptocoinjs / keccak

Keccak sponge function family
MIT License
87 stars 24 forks source link

Does not work on Node 12 #10

Closed thith closed 5 years ago

thith commented 5 years ago

This package does not build on Node 12 and always fallback to JS implementation. This is due to changes in V8 that makes many other native modules fail to build. secp256k1-node package already fixed https://github.com/cryptocoinjs/secp256k1-node/pull/143

Build log:

keccak@1.4.0 rebuild /Users/thi/Documents/GitHub/icetea/node_modules/keccak
> node-gyp rebuild

  CXX(target) Release/obj.target/keccak/src/addon.o
../src/addon.cc:37:47: error: too few arguments to function call, single argument 'context' was not specified
    unsigned int rate = info[0]->IntegerValue();
                        ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/thi/.node-gyp/12.3.1/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/thi/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/addon.cc:38:51: error: too few arguments to function call, single argument 'context' was not specified
    unsigned int capacity = info[1]->IntegerValue();
                            ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/thi/.node-gyp/12.3.1/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/thi/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/addon.cc:56:48: error: too few arguments to function call, single argument 'context' was not specified
    unsigned char bits = info[0]->IntegerValue();
                         ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/thi/.node-gyp/12.3.1/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/thi/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/addon.cc:64:43: error: too few arguments to function call, single argument 'context' was not specified
    size_t length = info[0]->IntegerValue();
                    ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/thi/.node-gyp/12.3.1/include/node/v8.h:2565:3: note: 'IntegerValue' declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/thi/.node-gyp/12.3.1/include/node/v8config.h:347:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/addon.cc:75:73: error: no matching member function for call to 'ToObject'
    KeccakWrapper* to = Nan::ObjectWrap::Unwrap<KeccakWrapper>(info[0]->ToObject());
                                                               ~~~~~~~~~^~~~~~~~
/Users/thi/.node-gyp/12.3.1/include/node/v8.h:2532:44: note: candidate function not viable: requires single argument 'context', but no
      arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
/Users/thi/.node-gyp/12.3.1/include/node/v8.h:2546:35: note: candidate function not viable: requires single argument 'isolate', but no
      arguments were provided
                    Local<Object> ToObject(Isolate* isolate) const);
                                  ^
5 errors generated.
make: *** [Release/obj.target/keccak/src/addon.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/thi/.nvm/versions/node/v12.3.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/Users/thi/.nvm/versions/node/v12.3.1/bin/node" "/Users/thi/.nvm/versions/node/v12.3.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/thi/Documents/GitHub/icetea/node_modules/keccak
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@1.4.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the keccak@1.4.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/thi/.npm/_logs/2019-05-26T08_05_15_984Z-debug.log
Keccak bindings compilation fail. Pure JS implementation will be used.
fanatid commented 5 years ago

Should be fixed with #13