node-opencv icon indicating copy to clipboard operation
node-opencv copied to clipboard

Possibly incompatible with nodeJS 4.0.0 ?

Open bogas04 opened this issue 11 years ago • 42 comments

I get following error while installing opencv using npm on OSX machine with OpenCV 2.4.12 installed using homebrew

npm install opencv
\
> [email protected] install /Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv
> node-pre-gyp install --fallback-to-build

(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
  CXX(target) Release/obj.target/opencv/src/init.o
In file included from ../src/init.cc:1:
In file included from ../src/OpenCV.h:12:
../node_modules/nan/nan.h:324:27: error: redefinition of 'NanEnsureHandleOrPersistent'
  NAN_INLINE v8::Local<T> NanEnsureHandleOrPersistent(const v8::Local<T> &val) {
                          ^
../node_modules/nan/nan.h:319:17: note: previous definition is here
  v8::Handle<T> NanEnsureHandleOrPersistent(const v8::Handle<T> &val) {
                ^
../node_modules/nan/nan.h:344:27: error: redefinition of 'NanEnsureLocal'
  NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Handle<T> &val) {
                          ^
../node_modules/nan/nan.h:334:27: note: previous definition is here
  NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Local<T> &val) {
                          ^
../node_modules/nan/nan.h:757:13: error: no member named 'smalloc' in namespace 'node'
    , node::smalloc::FreeCallback callback
      ~~~~~~^
../node_modules/nan/nan.h:768:12: error: no matching function for call to 'New'
    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
           ^~~~~~~~~~~~~~~~~
/Users/USER/.node-gyp/4.0.0/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t'
      (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/USER/.node-gyp/4.0.0/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const
      qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/USER/.node-gyp/4.0.0/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                       ^
/Users/USER/.node-gyp/4.0.0/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
In file included from ../src/init.cc:1:
In file included from ../src/OpenCV.h:12:
../node_modules/nan/nan.h:772:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
    return node::Buffer::New(v8::Isolate::GetCurrent(), size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' for 1st argument
class Local {
      ^
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object> &&' for 1st argument
class Local {
      ^
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
  V8_INLINE Local(Local<S> that)
            ^
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
  V8_INLINE Local(S* that)
            ^
In file included from ../src/init.cc:1:
In file included from ../src/OpenCV.h:12:
../node_modules/nan/nan.h:779:26: error: no member named 'Use' in namespace 'node::Buffer'
    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
           ~~~~~~~~~~~~~~^
In file included from ../src/init.cc:1:
In file included from ../src/OpenCV.h:4:
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:501:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
                             ^
In file included from ../src/init.cc:1:
In file included from ../src/OpenCV.h:4:
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:511:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
                             ^
In file included from ../src/init.cc:1:
In file included from ../src/OpenCV.h:4:
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1645:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
           ^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
                             ^
In file included from ../src/init.cc:1:
In file included from ../src/OpenCV.h:4:
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/USER/.node-gyp/4.0.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1776:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
    return NanEscapeScope(
           ^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
                             ^
10 errors generated.
make: *** [Release/obj.target/opencv/src/init.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:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/iojs" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=opencv" "--configuration=Release" "--module_name=opencv" "--version=3.2.0" "--major=3" "--minor=2" "--runtime=node" "--node_abi=node-v46" "--platform=darwin" "--target_platform=darwin" "--arch=x64" "--target_arch=x64" "--module_main=./lib/opencv" "--host=https://node-opencv.s3.amazonaws.com/" "--module_path=/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/build/opencv/v3.2.0/Release/node-v46-darwin-x64" "--module=/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/build/opencv/v3.2.0/Release/node-v46-darwin-x64/opencv.node" "--remote_path=./opencv/v3.2.0/Release/" "--package_name=node-v46-darwin-x64.tar.gz" "--staged_tarball=build/stage/opencv/v3.2.0/Release/node-v46-darwin-x64.tar.gz" "--hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/" "--hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/node-v46-darwin-x64.tar.gz"
gyp ERR! cwd /Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/iojs /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild --name=opencv --configuration=Release --module_name=opencv --version=3.2.0 --major=3 --minor=2 --runtime=node --node_abi=node-v46 --platform=darwin --target_platform=darwin --arch=x64 --target_arch=x64 --module_main=./lib/opencv --host=https://node-opencv.s3.amazonaws.com/ --module_path=/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/build/opencv/v3.2.0/Release/node-v46-darwin-x64 --module=/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/build/opencv/v3.2.0/Release/node-v46-darwin-x64/opencv.node --remote_path=./opencv/v3.2.0/Release/ --package_name=node-v46-darwin-x64.tar.gz --staged_tarball=build/stage/opencv/v3.2.0/Release/node-v46-darwin-x64.tar.gz --hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/ --hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/node-v46-darwin-x64.tar.gz' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:817:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 14.5.0
node-pre-gyp ERR! command "/usr/local/bin/iojs" "/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv
node-pre-gyp ERR! node -v v4.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.5.31
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/iojs /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild --name=opencv --configuration=Release --module_name=opencv --version=3.2.0 --major=3 --minor=2 --runtime=node --node_abi=node-v46 --platform=darwin --target_platform=darwin --arch=x64 --target_arch=x64 --module_main=./lib/opencv --host=https://node-opencv.s3.amazonaws.com/ --module_path=/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/build/opencv/v3.2.0/Release/node-v46-darwin-x64 --module=/Users/USER/Work/Code/NodeJS/FaceRecog/node_modules/opencv/build/opencv/v3.2.0/Release/node-v46-darwin-x64/opencv.node --remote_path=./opencv/v3.2.0/Release/ --package_name=node-v46-darwin-x64.tar.gz --staged_tarball=build/stage/opencv/v3.2.0/Release/node-v46-darwin-x64.tar.gz --hosted_path=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/ --hosted_tarball=https://node-opencv.s3.amazonaws.com/opencv/v3.2.0/Release/node-v46-darwin-x64.tar.gz' (1)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install" "opencv"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.2
npm ERR! code ELIFECYCLE

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

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/USER/Work/Code/NodeJS/FaceRecog/npm-debug.log

bogas04 avatar Sep 10 '15 10:09 bogas04

It builds well on using 0.12.7

bogas04 avatar Sep 10 '15 11:09 bogas04

+1, isn't properly installing for me, either

eliothxchan avatar Sep 11 '15 13:09 eliothxchan

Adding to the list: https://github.com/nodejs/node/issues/2798. nan dependency has to be updated to v2.

ChALkeR avatar Sep 12 '15 17:09 ChALkeR

+1

JonnyBGod avatar Sep 16 '15 01:09 JonnyBGod

+1

davduran avatar Sep 25 '15 10:09 davduran

+1

keeganbrown avatar Sep 29 '15 16:09 keeganbrown

+1 I am encountering this issue on Raspberry Pi B running Linux raspberrypi 4.1.7+ #817 PREEMPT Sat Sep 19 15:25:36 BST 2015 armv6l GNU/Linux

Node version v0.12.6

emaggini avatar Sep 30 '15 00:09 emaggini

+1

aaaristo avatar Oct 01 '15 12:10 aaaristo

+1

BryceBeagle avatar Oct 02 '15 01:10 BryceBeagle

I've got a fork with node-opencv building correctly using node 4.1.1, but failing to build in 0.12.7, if anyone has time to figure out how to make it work in both. Here's my pull request: https://github.com/peterbraden/node-opencv/pull/309

keeganbrown avatar Oct 02 '15 16:10 keeganbrown

+1. Using node 4.1.1 and openCV 2.4.12 installed by using brew.

lzfelix avatar Oct 05 '15 13:10 lzfelix

+1

albertgarcias avatar Oct 05 '15 15:10 albertgarcias

As other people say, the best solution (tested in Mac and Ubuntu) is install node 4.x and openCV 2.4.x

davduran avatar Oct 05 '15 15:10 davduran

@davduran. I'm trying to do this but didn't succeed yet.

lzfelix avatar Oct 05 '15 15:10 lzfelix

I'm using windows 7 with Node 4.1.1 with OpenCV 2.4.11 and I'm having the same issue.

albertgarcias avatar Oct 05 '15 15:10 albertgarcias

  1. First uninstall your current openCV.

  2. Then install "brew".

  3. In the terminal: brew install opencv

  4. Check the openCV version installed: In linux/mac with command: make sure pkg-config --cflags You shoul'd get something like this: -I/usr/local/davduran/opencv/2.4.11_1/include/opencv -I/usr/local/davduran/opencv/2.4.11_1/include

  5. Now go to you node/project folder. And type in the terminal: npm install opencv --save

*Maybe you get some warnings but the project finally compile.

davduran avatar Oct 05 '15 15:10 davduran

If I have some time I will publish a script that automates the process.

davduran avatar Oct 05 '15 15:10 davduran

When running $make sure pkg-config --cflags, I get: /Applications/Xcode.app/Contents/Developer/usr/bin/make: unrecognized option `--cflags' Usage: make [options] [target] ... Options:

That's what I'm getting: http://pastebin.com/pVbsA3eL

lzfelix avatar Oct 05 '15 15:10 lzfelix

@lzfelix Look line #3:

[email protected] install /Users/luiz/Downloads/config-0.3.9/node_modules/opencv

You're trying to compile/install with opencv 3.2.0. You must ensure uninstall opencv 3.x from your system and the install 2.4.x.

davduran avatar Oct 05 '15 15:10 davduran

Sorry try with: pkg-config --cflags opencv

davduran avatar Oct 05 '15 15:10 davduran