Skip to content
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

Remove dependency on rabin #121

Open
NatoBoram opened this issue Dec 3, 2019 · 0 comments
Open

Remove dependency on rabin #121

NatoBoram opened this issue Dec 3, 2019 · 0 comments

Comments

@NatoBoram
Copy link

NatoBoram commented Dec 3, 2019

Hello!

The rabin package is a huge problem because it depends on node-gyp. Simply adding ipfs-npm as a devDependencies creates all of this garbage because its dependency rabin depends on node-gyp.

warning Error running install script for optional dependency: "/home/nato/Code/gitlab.com/NatoBoram/public-gateway-cacher/node_modules/rabin: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments: 
Directory: /home/nato/Code/gitlab.com/NatoBoram/public-gateway-cacher/node_modules/rabin
Output:
prebuild-install WARN install No prebuilt binaries found (target=13.2.0 runtime=node arch=x64 platform=linux)
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@13.2.0 | linux | x64
gyp info find Python using Python version 2.7.17 found at \"/usr/bin/python\"
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args   '/snap/node/2559/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/nato/Code/gitlab.com/NatoBoram/public-gateway-cacher/node_modules/rabin/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/snap/node/2559/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/nato/.cache/node-gyp/13.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/nato/.cache/node-gyp/13.2.0',
gyp info spawn args   '-Dnode_gyp_dir=/snap/node/2559/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/nato/.cache/node-gyp/13.2.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/nato/Code/gitlab.com/NatoBoram/public-gateway-cacher/node_modules/rabin',
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 ]
make: Entering directory '/home/nato/Code/gitlab.com/NatoBoram/public-gateway-cacher/node_modules/rabin/build'
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/rabin/bindings.o
In file included from ../bindings.cc:2:
../../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]
 2298 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
      |                                                              ^
In file included from ../../nan/nan.h:54,
                 from ../bindings.cc:2:
../bindings.cc: At global scope:
/home/nato/.cache/node-gyp/13.2.0/include/node/node.h:610:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
  610 |       (node::addon_register_func) (regfunc),                          \\\n      |                                           ^
/home/nato/.cache/node-gyp/13.2.0/include/node/node.h:644:3: note: in expansion of macro ‘NODE_MODULE_X’
  644 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../bindings.cc:16:1: note: in expansion of macro ‘NODE_MODULE’
   16 | NODE_MODULE(rabin, InitAll)
      | ^~~~~~~~~~~
In file included from /home/nato/.cache/node-gyp/13.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../bindings.cc:2:
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/nato/.cache/node-gyp/13.2.0/include/node/node_object_wrap.h:84:78:   required from here
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:10400:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
10400 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:10400:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  CXX(target) Release/obj.target/rabin/src/rabin.o
  CXX(target) Release/obj.target/rabin/src/rabin_wrap.o
In file included from ../src/rabin_wrap.h:4,
                 from ../src/rabin_wrap.cc:2:
../../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]
 2298 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
      |                                                              ^
../src/rabin_wrap.cc: In function ‘void get_fingerprints(rabin_t*, v8::Local<v8::Array>, v8::Local<v8::Array>)’:
../src/rabin_wrap.cc:11:61: error: no matching function for call to ‘v8::Array::Get(int&)’
   11 |     uint8_t *buf = (uint8_t*) node::Buffer::Data(bufs->Get(i));
      |                                                             ^
In file included from /home/nato/.cache/node-gyp/13.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/rabin_wrap.h:4,
                 from ../src/rabin_wrap.cc:2:
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3594:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3594 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3594:43: note:   candidate expects 2 arguments, 1 provided
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3597:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3597 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3597:43: note:   candidate expects 2 arguments, 1 provided
../src/rabin_wrap.cc:12:47: error: no matching function for call to ‘v8::Array::Get(int&)’
   12 |     int len = node::Buffer::Length(bufs->Get(i));
      |                                               ^
In file included from /home/nato/.cache/node-gyp/13.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/rabin_wrap.h:4,
                 from ../src/rabin_wrap.cc:2:
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3594:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3594 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3594:43: note:   candidate expects 2 arguments, 1 provided
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3597:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3597 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3597:43: note:   candidate expects 2 arguments, 1 provided
../src/rabin_wrap.cc:24:71: error: no matching function for call to ‘v8::Array::Set(int, Nan::imp::FactoryBase<v8::Number>::return_t)’
   24 |       lengths->Set(chunk_idx++, Nan::New<Number>(hasher->chunk_length));
      |                                                                       ^
In file included from /home/nato/.cache/node-gyp/13.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/rabin_wrap.h:4,
                 from ../src/rabin_wrap.cc:2:
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3547:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
 3547 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
      |                                     ^~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3547:37: note:   candidate expects 3 arguments, 2 provided
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3550:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
 3550 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:3550:37: note:   candidate expects 3 arguments, 2 provided
../src/rabin_wrap.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RabinWrap::Configure(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/rabin_wrap.cc:52:47: error: no matching function for call to ‘v8::Value::Uint32Value()’
   52 |   handle->average_bits = info[0]->Uint32Value();
      |                                               ^
In file included from /home/nato/.cache/node-gyp/13.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/rabin_wrap.h:4,
                 from ../src/rabin_wrap.cc:2:
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:2776:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2776 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:2776:41: note:   candidate expects 1 argument, 0 provided
../src/rabin_wrap.cc:53:42: error: no matching function for call to ‘v8::Value::Uint32Value()’
   53 |   handle->minsize = info[1]->Uint32Value();
      |                                          ^
In file included from /home/nato/.cache/node-gyp/13.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/rabin_wrap.h:4,
                 from ../src/rabin_wrap.cc:2:
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:2776:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2776 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:2776:41: note:   candidate expects 1 argument, 0 provided
../src/rabin_wrap.cc:54:42: error: no matching function for call to ‘v8::Value::Uint32Value()’
   54 |   handle->maxsize = info[2]->Uint32Value();
      |                                          ^
In file included from /home/nato/.cache/node-gyp/13.2.0/include/node/node.h:63,
                 from ../../nan/nan.h:54,
                 from ../src/rabin_wrap.h:4,
                 from ../src/rabin_wrap.cc:2:
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:2776:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
 2776 |   V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
      |                                         ^~~~~~~~~~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:2776:41: note:   candidate expects 1 argument, 0 provided
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/nato/.cache/node-gyp/13.2.0/include/node/node_object_wrap.h:84:78:   required from here
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:10400:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
10400 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/home/nato/.cache/node-gyp/13.2.0/include/node/v8.h:10400:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [rabin.target.mk:111: Release/obj.target/rabin/src/rabin_wrap.o] Error 1
make: Leaving directory '/home/nato/Code/gitlab.com/NatoBoram/public-gateway-cacher/node_modules/rabin/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/snap/node/2559/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
gyp ERR! System Linux 5.3.0-23-generic
gyp ERR! command \"/snap/node/2559/bin/node\" \"/snap/node/2559/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /home/nato/Code/gitlab.com/NatoBoram/public-gateway-cacher/node_modules/rabin

This is a problem for creating reproducible builds for software that use npm-ipfs. Simply put, it breaks everything.

I suggest only depending on quality software that won't try to break the user's system or doesn't depend on a user's specific configuration.

Since go-ipfs-chunker already has a Go rabin chunking implementation, it would be preferrable to compile this one to WebAssembly than to use one that actively tries to break any packages it's installed in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant