justadudewhohacks / npm-opencv-build

A simple script to auto build recent OpenCV + contrib version via npm
43 stars 57 forks source link

Build Error MacOS #41

Open KDederichs opened 4 years ago

KDederichs commented 4 years ago

Hey, I'm trying to install the node openCV package on my Mac development machine but sadly it's spitting out compile errors:

In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/baseapi.h:26:
In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/apitypes.h:23:
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr'
constexpr int kPointsPerInch = 72;
^
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:33:11: error: expected unqualified-id
constexpr int kPointsPerInch = 72;
          ^
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:38:1: error: unknown type name 'constexpr'
constexpr int kMinCredibleResolution = 70;
^
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:38:11: error: expected unqualified-id
constexpr int kMinCredibleResolution = 70;
          ^
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:40:1: error: unknown type name 'constexpr'
constexpr int kMaxCredibleResolution = 2400;
^
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:40:11: error: expected unqualified-id
constexpr int kMaxCredibleResolution = 2400;
          ^
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:45:1: error: unknown type name 'constexpr'
constexpr int kResolutionEstimationFactor = 10;
^
/usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:45:11: error: expected unqualified-id
constexpr int kResolutionEstimationFactor = 10;

Is there any special flag that needs to be set for it to work on Mac? All build tools/Xcode are up to date.

jnguyen19 commented 4 years ago

Yeah, i am getting the same thing trying to do an: npm install --save opencv4nodejs:

[ 85%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMILModel.cpp.o In file included from /Users//node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/erfilter.cpp:43: In file included from /Users//node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/precomp.hpp:54: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/baseapi.h:26: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/apitypes.h:23: /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr' constexpr int kPointsPerInch = 72; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:38:1: error: unknown type name 'constexpr' constexpr int kMinCredibleResolution = 70; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:40:1: error: unknown type name 'constexpr' constexpr int kMaxCredibleResolution = 2400; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:45:1: error: unknown type name 'constexpr' constexpr int kResolutionEstimationFactor = 10; ^ [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMedianFlow.cpp.o In file i

jnguyen19 commented 4 years ago

tried all sorts of suggested solution, pretty much same issue, with the latest code of everything: [ 86%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerSamplerAlgorithm.cpp.o In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/erfilter.cpp:43: In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/precomp.hpp:54: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/baseapi.h:26: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/apitypes.h:23: /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr' constexpr int kPointsPerInch = 72; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:38:1: error: unknown type name 'constexpr' constexpr int kMinCredibleResolution = 70; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:40:1: error: unknown type name 'constexpr' constexpr int kMaxCredibleResolution = 2400; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:45:1: error: unknown type name 'constexpr' constexpr int kResolutionEstimationFactor = 10; ^ In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/erfilter.cpp:43: In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/precomp.hpp:54: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/baseapi.h:30: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/resultiterator.h:27: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/ltrresultiterator.h:27: /usr/local/Cellar/tesseract/4.1.1/include/tesseract/unichar.h:171:8: error: function definition does not declare parameters char chars[UNICHAR_LEN]{};

chris-ryu commented 3 years ago

I have same problem [ 84%] Building CXX object modules/text/CMakeFiles/opencv_text.dir/src/ocr_tesseract.cpp.o In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/erfilter.cpp:43: In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/opencv_contrib/modules/text/src/precomp.hpp:54: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/baseapi.h:26: In file included from /usr/local/Cellar/tesseract/4.1.1/include/tesseract/apitypes.h:23: /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr' constexpr int kPointsPerInch = 72; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:38:1: error: unknown type name 'constexpr' constexpr int kMinCredibleResolution = 70; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:40:1: error: unknown type name 'constexpr' constexpr int kMaxCredibleResolution = 2400; ^ /usr/local/Cellar/tesseract/4.1.1/include/tesseract/publictypes.h:45:1: error: unknown type name 'constexpr' constexpr int kResolutionEstimationFactor = 10;

chris-ryu commented 3 years ago

brew unlink tesseract

After that problem solved.