opencv4nodejs icon indicating copy to clipboard operation
opencv4nodejs copied to clipboard

HELP! opencv4nodejs build error - macos

Open giovanihoff opened this issue 3 years ago • 12 comments

Description

Try of opencv4nodejs `s build was performed on two (2) distinct macbook, Big Sur and Catalina. In both the error occurred. The following commands were executed (in order):

brew update brew install opencv@4 brew link --force opencv@4 npm install --save opencv4nodejs

Error Message

[ 55%] Linking CXX shared library ../../lib/libopencv_core.dylib [ 55%] Built target opencv_core make: *** [all] Error 2 ERR! child process exited with code 2 (for more info, set '--loglevel silly') npm WARN xxx No description npm WARN xxx No repository field. npm WARN xxx No license field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node ./install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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! /Users/xxx/.npm/_logs/2021-10-20T16_45_13_750Z-debug.log

Error Log

219 verbose stack Error: [email protected] install: node ./install.js 219 verbose stack Exit status 1 219 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 219 verbose stack at EventEmitter.emit (events.js:400:28) 219 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 219 verbose stack at ChildProcess.emit (events.js:400:28) 219 verbose stack at maybeClose (internal/child_process.js:1058:16) 219 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5) 220 verbose pkgid [email protected] 221 verbose cwd /Users/xxx/workspace/components-ui-test 222 verbose Darwin 20.6.0 223 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "opencv4nodejs" 224 verbose node v14.18.1 225 verbose npm v6.14.15 226 error code ELIFECYCLE 227 error errno 1 228 error [email protected] install: node ./install.js 228 error Exit status 1 229 error Failed at the [email protected] install script. 229 error This is probably not a problem with npm. There is likely additional logging output above. 230 verbose exit [ 1, true ]

Setup

OpenCV version 5.6.0 Node version v14.18.1 NPM version 6.14.15 OS: MacOSX Big Sur version 11.6

Other Information

PLEASE, can anyone help me? Is anyone there? Is this project deprecated?

giovanihoff avatar Oct 20 '21 16:10 giovanihoff

Can you check if this version works for you? https://github.com/wandenberg/opencv4nodejs/commit/91bc118a43da570638db466e51cf56dbbf615b9e It was updated to compile with OpenCV 4.5.2+

wandenberg avatar Nov 09 '21 22:11 wandenberg

Can you check if this version works for you? wandenberg@91bc118 It was updated to compile with OpenCV 4.5.2+

OK, I will try with this version.

giovanihoff avatar Nov 12 '21 12:11 giovanihoff

@wandenberg Really thankful for your support. I've struggle with opencv4nodejs for days and days

I am able to install with node v14.18.1 on MacOS 10.15.6, but error with node v16.13.0 (opencv-build installed with opencv 4.5.3)

npm install

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 8 ] CXX(target) Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o CXX(target) Release/obj.target/opencv4nodejs/cc/CustomMatAllocator.o CXX(target) Release/obj.target/opencv4nodejs/cc/ExternalMemTracking.o CXX(target) Release/obj.target/opencv4nodejs/cc/core/core.o CXX(target) Release/obj.target/opencv4nodejs/cc/core/coreConstants.o CXX(target) Release/obj.target/opencv4nodejs/cc/core/HistAxes.o CXX(target) Release/obj.target/opencv4nodejs/cc/core/Mat.o CXX(target) Release/obj.target/opencv4nodejs/cc/core/Point.o In file included from ../cc/opencv4nodejs.cc:1: In file included from /Users/zi/Library/Caches/node-gyp/16.13.0/include/node/node.h:63: In file included from /Users/zi/Library/Caches/node-gyp/16.13.0/include/node/v8.h:30: /Users/zi/Library/Caches/node-gyp/16.13.0/include/node/v8-internal.h:492:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'? !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data); ~~~~~^~~~~~~~~~~ remove_cv /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:697:50: note: 'remove_cv' declared here template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv ^ In file included from ../cc/ExternalMemTracking.cc:1: In file included from ../cc/ExternalMemTracking.h:1: In file included from ../cc/macros.h:1: ...... ...... ...... ...... ../cc/core/Mat.cc:758:7: note: in instantiation of function template specialization 'FF::ObjectWrapTemplate<Mat, cv::Mat>::syncBindingCoreBindings::Solve' requested here Mat::syncBindingCoreBindings::Solve("Solve", info); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3607:23: note: qualify call to silence this warning _data.second().~_Tp(); ^ 45 warnings and 1 error generated. make: *** [Release/obj.target/opencv4nodejs/cc/core/Mat.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/zi/.nvm/versions/node/v16.13.0/lib/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:390:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Darwin 19.6.0 gyp ERR! command "/Users/zi/.nvm/versions/node/v16.13.0/bin/node" "/Users/zi/.nvm/versions/node/v16.13.0/bin/node-gyp" "rebuild" "--jobs" "max" gyp ERR! cwd /Users/zi/.nvm/versions/node/v16.13.0/lib/node_modules/opencv4nodejs gyp ERR! node -v v16.13.0 gyp ERR! node-gyp -v v8.4.0 gyp ERR! not ok

Jiyvn avatar Nov 13 '21 14:11 Jiyvn

Hi @Jiyvn sorry for the long delay. I could not find the exact reason for the error with Node16 + macOS, since the error trace does not start on this module code, but I found a workaround that is to specify the CXXFLAGS="--std=c++17" during installation. Something like CXXFLAGS="--std=c++17" npm install. At least it worked for me. I am looking for a way to specify this either on the code or on the package.json, if someone knows how to do it, please say it ;)

wandenberg avatar Dec 15 '21 23:12 wandenberg

I think I got it, can you try with this branch? https://github.com/wandenberg/opencv4nodejs/tree/change_compile_flags

wandenberg avatar Dec 15 '21 23:12 wandenberg

I think I got it, can you try with this branch? https://github.com/wandenberg/opencv4nodejs/tree/change_compile_flags

Use this, and worked! Thank you @wandenberg .

milkliker avatar Dec 28 '21 06:12 milkliker

@wandenberg This change on branch change_compile_flags solved this problem on my side. I did successfully install opencv4nodejs with node 16.13.0. really thankful for your help, appreciate it

Jiyvn avatar Jan 05 '22 14:01 Jiyvn

I also used the branch by @wandenberg.

Since the last release on this repo was about 2 years ago at the time I was looking at it. Is there a chance this could get merged?

chrisspiegl avatar Jan 18 '22 14:01 chrisspiegl

npm install @u4/opencv4nodejs

This fork contains @wandenberg change and may more and is actively maintained.

UrielCh avatar Jan 19 '22 08:01 UrielCh

npm install @u4/opencv4nodejs

This fork contains @wandenberg change and may more and is actively maintained.

I found the support from appium https://github.com/appium/appium/releases/tag/%40appium%2Fsupport%402.55.3 will appium focus on your fork in the near future? @UrielCh

Jiyvn avatar Jan 20 '22 07:01 Jiyvn

Hi, I did not get notified about that. If they want to use my fork they are welcome.

UrielCh avatar Jan 21 '22 12:01 UrielCh

worked for me as well @wandenberg thanks

shrutipathak1234 avatar Nov 01 '22 19:11 shrutipathak1234