justadudewhohacks / opencv4nodejs

Nodejs bindings to OpenCV 3 and OpenCV 4
MIT License
4.96k stars 826 forks source link

MacOS 10.14.5 install error,help me! #591

Open tmzdy888 opened 5 years ago

tmzdy888 commented 5 years ago

Error Message

[ 81%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/torch/torch_importer.cpp.o [ 81%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx.cpp.o [ 81%] Linking CXX shared library ../../lib/libopencv_features2d.dylib [ 81%] Built target opencv_features2d [ 81%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx2.cpp.o [ 81%] Processing OpenCL kernels (calib3d) Scanning dependencies of target opencv_calib3d [ 81%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/ap3p.cpp.o [ 81%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/calib3d_c_api.cpp.o [ 81%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/layers/layers_common.avx512_skx.cpp.o [ 82%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/calibinit.cpp.o [ 82%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/calibration.cpp.o [ 82%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/calibration_handeye.cpp.o [ 82%] Linking CXX shared library ../../lib/libopencv_dnn.dylib [ 82%] Built target opencv_dnn [ 82%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/checkchessboard.cpp.o [ 82%] Processing OpenCL kernels (tracking) Scanning dependencies of target opencv_tracking [ 82%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/augmented_unscented_kalman.cpp.o Scanning dependencies of target opencv_text [ 82%] Building CXX object modules/text/CMakeFiles/opencv_text.dir/src/erfilter.cpp.o In file included from /Users/liuping/Desktop/opencv/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/erfilter.cpp:43: In file included from /Users/liuping/Desktop/opencv/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/precomp.hpp:54: In file included from /usr/local/include/tesseract/baseapi.h:27: In file included from /usr/local/include/tesseract/apitypes.h:23: /usr/local/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr' constexpr int kPointsPerInch = 72; ^ /usr/local/include/tesseract/publictypes.h:33:11: error: expected unqualified-id constexpr int kPointsPerInch = 72; ^ /usr/local/include/tesseract/publictypes.h:38:1: error: unknown type name 'constexpr' constexpr int kMinCredibleResolution = 70; ^ /usr/local/include/tesseract/publictypes.h:38:11: error: expected unqualified-id constexpr int kMinCredibleResolution = 70; ^ /usr/local/include/tesseract/publictypes.h:40:1: error: unknown type name 'constexpr' constexpr int kMaxCredibleResolution = 2400; ^ /usr/local/include/tesseract/publictypes.h:40:11: error: expected unqualified-id constexpr int kMaxCredibleResolution = 2400; ^ /usr/local/include/tesseract/publictypes.h:45:1: error: unknown type name 'constexpr' constexpr int kResolutionEstimationFactor = 10; ^ /usr/local/include/tesseract/publictypes.h:45:11: error: expected unqualified-id constexpr int kResolutionEstimationFactor = 10; ^ In file included from /Users/liuping/Desktop/opencv/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/erfilter.cpp:43: In file included from /Users/liuping/Desktop/opencv/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/precomp.hpp:54: In file included from /usr/local/include/tesseract/baseapi.h:31: /usr/local/include/tesseract/resultiterator.h:103:63: error: a space is required between consecutive right angle brackets (use '> >') virtual std::vector<std::vector<std::pair<const char*, float>>>* GetBe... ^ In file included from /Users/liuping/Desktop/opencv/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/erfilter.cpp:43: In file included from /Users/liuping/Desktop/opencv/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/precomp.hpp:54: In file included from /usr/local/include/tesseract/baseapi.h:32: /usr/local/include/tesseract/serialis.h:43:1: error: unknown type name 'constexpr' constexpr size_t countof(T const (&)[N]) noexcept { ^ /usr/local/include/tesseract/serialis.h:43:17: error: expected ';' at end of declaration constexpr size_t countof(T const (&)[N]) noexcept { ^ /usr/local/include/tesseract/serialis.h:43:18: error: C++ requires a type specifier for all declarations constexpr size_t countof(T const (&)[N]) noexcept { ^ /usr/local/include/tesseract/serialis.h:43:26: error: use of undeclared identifier 'T' constexpr size_t countof(T const (&)[N]) noexcept { ^ /usr/local/include/tesseract/serialis.h:43:41: error: expected ';' after top level declarator constexpr size_t countof(T const (&)[N]) noexcept { ^ /usr/local/include/tesseract/serialis.h:56:40: error: unknown type name 'size_t' bool DeSerialize(FILE* fp, char* data, size_t n = 1); ^ /usr/local/include/tesseract/serialis.h:57:41: error: unknown type name 'size_t' bool DeSerialize(FILE* fp, float* data, size_t n = 1); ^ /usr/local/include/tesseract/serialis.h:58:42: error: unknown type name 'size_t' bool DeSerialize(FILE* fp, int8_t* data, size_t n = 1); ^ /usr/local/include/tesseract/serialis.h:59:43: error: unknown type name 'size_t' bool DeSerialize(FILE* fp, int16_t* data, size_t n = 1); ^ /usr/local/include/tesseract/serialis.h:60:43: error: unknown type name 'size_t' bool DeSerialize(FILE* fp, int32_t* data, size_t n = 1); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make[2]: *** [modules/text/CMakeFiles/opencv_text.dir/src/erfilter.cpp.o] Error 1 make[1]: *** [modules/text/CMakeFiles/opencv_text.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/feature.cpp.o [ 83%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/circlesgrid.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/featureColorName.cpp.o [ 83%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/compat_ptsetreg.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/gtrTracker.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/gtrUtils.cpp.o [ 83%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/compat_stereo.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/mosseTracker.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/multiTracker.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/multiTracker_alt.cpp.o [ 83%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/dls.cpp.o [ 83%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/epnp.cpp.o [ 83%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/fisheye.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/onlineBoosting.cpp.o [ 83%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/onlineMIL.cpp.o [ 84%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/five-point.cpp.o [ 84%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tldDataset.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tldDetector.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tldEnsembleClassifier.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tldModel.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tldTracker.cpp.o [ 85%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/fundam.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tldUtils.cpp.o [ 85%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/homography_decomp.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tracker.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerBoosting.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerBoostingModel.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerCSRT.cpp.o [ 85%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/levmarq.cpp.o [ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerCSRTScaleEstimation.cpp.o [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerCSRTSegmentation.cpp.o [ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/main.cpp.o [ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/p3p.cpp.o [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerCSRTUtils.cpp.o [ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/polynom_solver.cpp.o [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerFeature.cpp.o [ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/posit.cpp.o [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerFeatureSet.cpp.o [ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/ptsetreg.cpp.o [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerKCF.cpp.o [ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/quadsubpix.cpp.o [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMIL.cpp.o [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMILModel.cpp.o [ 87%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/rho.cpp.o [ 87%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/solvepnp.cpp.o [ 87%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMedianFlow.cpp.o [ 87%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerModel.cpp.o [ 87%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/stereobm.cpp.o [ 87%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerSampler.cpp.o [ 88%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerSamplerAlgorithm.cpp.o [ 88%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/stereosgbm.cpp.o [ 88%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerStateEstimator.cpp.o [ 88%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tracking_utils.cpp.o [ 88%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/unscented_kalman.cpp.o [ 88%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/opencl_kernels_tracking.cpp.o [ 88%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/triangulate.cpp.o [ 88%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/upnp.cpp.o [ 88%] Linking CXX shared library ../../lib/libopencv_tracking.dylib [ 88%] Built target opencv_tracking [ 88%] Building CXX object modules/calib3d/CMakeFiles/opencv_calib3d.dir/opencl_kernels_calib3d.cpp.o [ 88%] Linking CXX shared library ../../lib/libopencv_calib3d.dylib [ 88%] Built target opencv_calib3d make: *** [all] Error 2 ERR! child process exited with code 2 (for more info, set '--loglevel silly')

Auto Build - Full Error Log

Manual Build - Environment Information

OpenCV version : 3.4

With OpenCV-contrib? (extra modules): yes

OS: MacOSX

tmzdy888 commented 5 years ago

**

emm~~~ i update ffmpeg ,ctro ,isOK. but! show ohter errors:

** opencv4nodejs@5.1.0 install /Users/liuping/Desktop/opencv/node_modules/opencv4nodejs

node-gyp rebuild --jobs max

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 In file included from ../cc/core/core.cc:1: In file included from ../cc/core/core.h:1: In file included from ../cc/core/Mat.h:1: In file included from ../cc/core/coreUtils.h:1: ../cc/macros.h:2:10: fatal error: 'opencv2/core.hpp' file not found

include <opencv2/core.hpp>

     ^~~~~~~~~~~~~~~~~~

In file included from ../cc/opencv4nodejs.cc:2: In file included from ../cc/ExternalMemTracking.h:1: ../cc/macros.h:2:10: fatal error: 'opencv2/core.hpp' file not found

include <opencv2/core.hpp>

     ^~~~~~~~~~~~~~~~~~

In file included from ../cc/ExternalMemTracking.cc:1: In file included from ../cc/ExternalMemTracking.h:1: ../cc/macros.h:2:10: fatal error: 'opencv2/core.hpp' file not found

include <opencv2/core.hpp>

     ^~~~~~~~~~~~~~~~~~

In file included from ../cc/CustomMatAllocator.cc:1: In file included from ../cc/CustomMatAllocator.h:8: ../cc/core/Size.h:1:10: fatal error: 'opencv2/core.hpp' file not found

include <opencv2/core.hpp>

     ^~~~~~~~~~~~~~~~~~

1 error generated. make: [Release/obj.target/opencv4nodejs/cc/ExternalMemTracking.o] Error 1 make: Waiting for unfinished jobs.... 1 error generated. make: [Release/obj.target/opencv4nodejs/cc/CustomMatAllocator.o] Error 1 1 error generated. make: [Release/obj.target/opencv4nodejs/cc/core/core.o] Error 1 1 error generated. make: *** [Release/obj.target/opencv4nodejs/cc/opencv4nodejs.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:262:23) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Darwin 18.6.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--jobs" "max" gyp ERR! cwd /Users/liuping/Desktop/opencv/node_modules/opencv4nodejs gyp ERR! node -v v10.16.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN opecv@0.0.1 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! opencv4nodejs@5.1.0 install: node-gyp rebuild --jobs max npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the opencv4nodejs@5.1.0 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/liuping/.npm/_logs/2019-07-07T07_07_30_198Z-debug.log

iLeonidze commented 5 years ago

Having the same problem on MacOS. Solved manually installing OpenCV via Brew and disabling opencv rebuild on opencv4nodejs installation.

justadudewhohacks commented 5 years ago

I think you are facing the same issue as #401. Try out the suggested workaround.

tmzdy888 commented 5 years ago

Having the same problem on MacOS. Solved manually installing OpenCV via Brew and disabling opencv rebuild on opencv4nodejs installation.

disabling rebuild,em. Then how do I compile it? Thank you for your answer, I hope you can help me.

tmzdy888 commented 5 years ago

I think you are facing the same issue as #401. Try out the suggested workaround.

Thank you for your reply, I saw the reply of #401, but I don't know how to start, thank you for taking the time to answer me, but maybe I can't solve it, oh my god. I am a newbie.

goulash1971 commented 5 years ago

@91xtw it's a nasty little issue .. try the workaround and post any problem that you have and I will serif I can help :) ... one of these days I will take a look at the root cause, but at the moment I'm neck deep in an optimisation task !!!

tmzdy888 commented 5 years ago

@91xtw it's a nasty little issue .. try the workaround and post any problem that you have and I will serif I can help :) ... one of these days I will take a look at the root cause, but at the moment I'm neck deep in an optimisation task !!! @goulash1971 Thank you very much, I am in China, I go back to install at night, maybe it is the daytime in the United States, um, there is very little information about Opencv4nodejs, I rely on a limited translation plugin to find the installation method, but I have not succeeded, if You can help me install it, I will make a Chinese installation method, put it in the Chinese network, which may help too many people. Thank you very much for your unselfish help. I went home after work and re-installed, telling the problems I encountered. Well, because it takes about an hour or so to reinstall each time, our online installation from the US server is very slow. 非常非常感谢,我在中国,我晚上回去安装,也许正是美国的白天,嗯,关于Opencv4nodejs资料非常的少,我是靠有限的翻译插件,来寻找安装方法,但始终我并未成功,如果你能帮助我安装好,我会做成中文的安装方法,放在中国的网络里,这也许能帮助太多的人。非常感谢你无私的帮助。我下班后回家着手重新安装,把遇到的的问题告诉。嗯,因为每重新安装一次需要花费大概1小时左右 时间 ,我们从美国服务器在线安装非常缓慢。

goulash1971 commented 5 years ago

@91xtw - I am very happy to help if I can.

The people on this project (and especially @justadudewhohacks) have been very responsive and helped me out a bunch of times. If there is something I can help with on this I will.

Btw. I am in Australia so will be in your timezone for a little longer :)

slushnys commented 5 years ago

When disabling the auto build and installing it with npm i get many warnings on almost every C++ file.

In addition after installing it, I see found 1025 vulnerabilities (63 low, 1 moderate, 961 high)

Pavithra24x7 commented 3 years ago

Having the same problem on MacOS. Solved manually installing OpenCV via Brew and disabling opencv rebuild on opencv4nodejs installation.

Can you please share the steps that you followed with the commands.

Thanks!