Pouchdb: npm install issues with exec-sync/ffi dependencies

Created on 13 May 2015  路  4Comments  路  Source: pouchdb/pouchdb

This project lists exec-sync as a dependency, which in turn has a dependency on an old version of ffi. When I tried to do npm install on OSX I got some build errors on ffi. But npm install -g ffi worked!

The problem is that https://github.com/jeremyfa/node-exec-sync has a hard-coded dependency on an old version of ffi.

Here are the errors that I got (on OSX Lion, yes I know it is old!):

> [email protected] install /Users/cbrody/Documents/brodybits/sqltest1/pouchtest1/pouchdb/node_modules/exec-sync/node_modules/ffi/node_modules/ref
> node-gyp rebuild

  CXX(target) Release/obj.target/binding/src/binding.o
  SOLINK_MODULE(target) Release/binding.node
  SOLINK_MODULE(target) Release/binding.node: Finished

> [email protected] install /Users/cbrody/Documents/brodybits/sqltest1/pouchtest1/pouchdb/node_modules/exec-sync/node_modules/ffi
> node-gyp rebuild

  CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/darwin.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/darwin64.o
  LIBTOOL-STATIC Release/libffi.a
  CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
In file included from ../src/ffi.cc:2:
../src/ffi.h:57:43: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
    static Handle<Value> FFIPrepCif(const Arguments& args);
                                          ^~~~~~~~~
                                          v8::internal::Arguments
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
In file included from ../src/ffi.cc:2:
../src/ffi.h:58:46: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
    static Handle<Value> FFIPrepCifVar(const Arguments& args);
                                             ^~~~~~~~~
                                             v8::internal::Arguments
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
In file included from ../src/ffi.cc:2:
../src/ffi.h:59:40: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
    static Handle<Value> FFICall(const Arguments& args);
                                       ^~~~~~~~~
                                       v8::internal::Arguments
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
In file included from ../src/ffi.cc:2:
../src/ffi.h:60:45: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
    static Handle<Value> FFICallAsync(const Arguments& args);
                                            ^~~~~~~~~
                                            v8::internal::Arguments
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
In file included from ../src/ffi.cc:2:
../src/ffi.h:64:40: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
    static Handle<Value> Strtoul(const Arguments& args);
                                       ^~~~~~~~~
                                       v8::internal::Arguments
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
In file included from ../src/ffi.cc:2:
../src/ffi.h:94:41: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
    static Handle<Value> Callback(const Arguments& args);
                                        ^~~~~~~~~
                                        v8::internal::Arguments
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/ffi.cc:19:15: error: calling a protected constructor of class 'v8::HandleScope'
  HandleScope scope;
              ^
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:816:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/ffi.cc:21:3: error: unexpected namespace name 'Buffer': expected expression
  Buffer *buf = Buffer::New(ptr, length, wrap_pointer_cb, user_data);
  ^
../src/ffi.cc:21:11: error: use of undeclared identifier 'buf'
  Buffer *buf = Buffer::New(ptr, length, wrap_pointer_cb, user_data);
          ^
../src/ffi.cc:22:16: error: no member named 'Close' in 'v8::HandleScope'
  return scope.Close(buf->handle_);
         ~~~~~ ^
../src/ffi.cc:22:22: error: use of undeclared identifier 'buf'
  return scope.Close(buf->handle_);
                     ^
../src/ffi.cc:28:33: error: too few arguments to function call, single argument 'isolate' was not specified
  Local<Object> o = Object::New();
                    ~~~~~~~~~~~ ^
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:2388:3: note: 'New' declared here
  static Local<Object> New(Isolate* isolate);
  ^
../src/ffi.cc:31:18: error: no member named 'NewSymbol' in 'v8::String'; did you mean 'IsSymbol'?
  o->Set(String::NewSymbol("dlopen"),  WrapPointer((char *)dlopen));
         ~~~~~~~~^~~~~~~~~
                 IsSymbol
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:1379:8: note: 'IsSymbol' declared here
  bool IsSymbol() const;
       ^
../src/ffi.cc:31:18: error: call to non-static member function without an object argument
  o->Set(String::NewSymbol("dlopen"),  WrapPointer((char *)dlopen));
         ~~~~~~~~^~~~~~~~~
../src/ffi.cc:32:18: error: no member named 'NewSymbol' in 'v8::String'; did you mean 'IsSymbol'?
  o->Set(String::NewSymbol("dlclose"), WrapPointer((char *)dlclose));
         ~~~~~~~~^~~~~~~~~
                 IsSymbol
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:1379:8: note: 'IsSymbol' declared here
  bool IsSymbol() const;
       ^
../src/ffi.cc:32:18: error: call to non-static member function without an object argument
  o->Set(String::NewSymbol("dlclose"), WrapPointer((char *)dlclose));
         ~~~~~~~~^~~~~~~~~
../src/ffi.cc:33:18: error: no member named 'NewSymbol' in 'v8::String'; did you mean 'IsSymbol'?
  o->Set(String::NewSymbol("dlsym"),   WrapPointer((char *)dlsym));
         ~~~~~~~~^~~~~~~~~
                 IsSymbol
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:1379:8: note: 'IsSymbol' declared here
  bool IsSymbol() const;
       ^
../src/ffi.cc:33:18: error: call to non-static member function without an object argument
  o->Set(String::NewSymbol("dlsym"),   WrapPointer((char *)dlsym));
         ~~~~~~~~^~~~~~~~~
../src/ffi.cc:34:18: error: no member named 'NewSymbol' in 'v8::String'; did you mean 'IsSymbol'?
  o->Set(String::NewSymbol("dlerror"), WrapPointer((char *)dlerror));
         ~~~~~~~~^~~~~~~~~
                 IsSymbol
/Users/cbrody/.node-gyp/0.12.2/deps/v8/include/v8.h:1379:8: note: 'IsSymbol' declared here
  bool IsSymbol() const;
       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/ffi_bindings/src/ffi.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/cbrody/Documents/brodybits/sqltest1/pouchtest1/pouchdb/node_modules/exec-sync/node_modules/ffi
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok 
npm ERR! Darwin 11.4.2
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.2
npm ERR! npm  v2.8.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the ffi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls ffi
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/cbrody/Documents/brodybits/sqltest1/pouchtest1/pouchdb/npm-debug.log

Most helpful comment

Here are the steps I followed as a workaround to npm install for testing:

  • removed exec-sync dependency from package.json
  • npm install ffi (installs latest version ok)
  • git clone https://github.com/jeremyfa/node-exec-sync
  • edit node-exec-sync/package.json to remove the ffi dependency line
  • npm install ./node-exec-sync
  • then npm install finished ok

All 4 comments

Here are the steps I followed as a workaround to npm install for testing:

  • removed exec-sync dependency from package.json
  • npm install ffi (installs latest version ok)
  • git clone https://github.com/jeremyfa/node-exec-sync
  • edit node-exec-sync/package.json to remove the ffi dependency line
  • npm install ./node-exec-sync
  • then npm install finished ok

I think this is due to us not supporting Node 0.12 or iojs. We only support 0.10 currently.

@nolanlawson I was able to run some of the PouchDB tests on Android (simulator), having trouble with some replication tests which I suspect is due to my own environment. My first try to run the tests on iOS did not work at all (again, due to my environment). I have some other things coming up and can probably work on this again sometime next week.

Can you give me an idea where (in which test scripts) you see the failures and if there is any significant difference in results between Android and iOS?

We have fixed support for iojs although it does seems to be relatively unstable now, this is green in our CI so if you have another issue could you open another bug for it, thanks for reporting

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ohmoses picture ohmoses  路  4Comments

leorsida picture leorsida  路  4Comments

nolanlawson picture nolanlawson  路  6Comments

virtualit786 picture virtualit786  路  5Comments

xub picture xub  路  4Comments