justadudewhohacks / opencv4nodejs

Nodejs bindings to OpenCV 3 and OpenCV 4
MIT License
4.94k stars 820 forks source link

[Autobuild] Installation error on ubuntu18.04 #639

Open zi-l opened 4 years ago

zi-l commented 4 years ago
npm install --save opencv4nodejs

Error Message

info libs -Wl,-rpath,/home/ubu/node_modules/opencv-build/opencv/build/lib
info install spawning node gyp process: node-gyp rebuild --jobs max
make: Entering directory '/home/ubu/node_modules/opencv4nodejs/build'
  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/Mat.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/core/Point.o
In file included from /home/ubu/node_modules/opencv-build/opencv/build/include/opencv2/ml.hpp:1967:0,
                 from ../cc/machinelearning/machinelearning.h:3,
                 from ../cc/opencv4nodejs.cc:25:
/home/ubu/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp: In function ‘int cv::ml::simulatedAnnealingSolver(SimulatedAnnealingSolverSystem&, double, double, double, size_t, double*, cv::RNG&)’:
/home/ubu/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp:55:0: note: -Wmisleading-indentation is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
     return exchange;

  CXX(target) Release/obj.target/opencv4nodejs/cc/core/Vec.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/core/Size.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/core/Rect.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/core/RotatedRect.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/core/TermCriteria.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/imgproc/imgproc.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/imgproc/imgprocConstants.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/imgproc/MatImgproc.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/imgproc/Contour.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/imgproc/Moments.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/calib3d/calib3d.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/calib3d/calib3dConstants.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/calib3d/MatCalib3d.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/io/io.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/io/ioConstants.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/io/VideoCapture.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/io/VideoWriter.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/photo/photo.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/photo/photoConstants.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/photo/MatPhoto.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/video/video.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/video/BackgroundSubtractor.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/video/BackgroundSubtractorMOG2.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/video/BackgroundSubtractorKNN.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/ximgproc/ximgproc.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/ximgproc/MatXimgproc.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/ximgproc/SuperpixelSEEDS.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/ximgproc/SuperpixelSLIC.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/ximgproc/SuperpixelLSC.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/objdetect/objdetect.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/objdetect/CascadeClassifier.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/objdetect/HOGDescriptor.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/objdetect/DetectionROI.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/machinelearning/machinelearning.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/machinelearning/machinelearningConstants.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/machinelearning/ParamGrid.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/machinelearning/StatModel.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/machinelearning/SVM.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/machinelearning/TrainData.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/dnn/dnn.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/dnn/Net.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/face.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/FaceRecognizer.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/EigenFaceRecognizer.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/FisherFaceRecognizer.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/LBPHFaceRecognizer.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/Facemark.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/FacemarkAAM.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/FacemarkAAMData.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/FacemarkAAMParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/FacemarkLBF.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/face/FacemarkLBFParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/text/text.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/text/OCRHMMClassifier.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/text/OCRHMMDecoder.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/tracking.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Tracker.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/MultiTracker.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerBoosting.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerBoostingParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerKCF.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerKCFParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerMIL.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerMILParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerMedianFlow.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerTLD.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerGOTURN.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerCSRT.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerCSRTParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/tracking/Trackers/TrackerMOSSE.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/features2d.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/KeyPoint.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/KeyPointMatch.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/DescriptorMatch.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/BFMatcher.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/FeatureDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/descriptorMatching.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/descriptorMatchingKnn.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/AGASTDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/AKAZEDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/BRISKDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/FASTDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/GFTTDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/KAZEDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/MSERDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/ORBDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/SimpleBlobDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/features2d/detectors/SimpleBlobDetectorParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/xfeatures2d/xfeatures2d.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/xfeatures2d/SIFTDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/xfeatures2d/SURFDetector.o
  SOLINK_MODULE(target) Release/obj.target/opencv4nodejs.node
  COPY Release/opencv4nodejs.node
make: Leaving directory '/home/ubu/node_modules/opencv4nodejs/build'
ERR! In file included from /home/ubu/node_modules/opencv-build/opencv/build/include/opencv2/ml.hpp:1967:0,
                 from ../cc/machinelearning/machinelearning.h:3,
                 from ../cc/opencv4nodejs.cc:25:
/home/ubu/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp: In function ‘int cv::ml::simulatedAnnealingSolver(SimulatedAnnealingSolverSystem&, double, double, double, size_t, double*, cv::RNG&)’:
/home/ubu/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp:55:0: note: -Wmisleading-indentation is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
     return exchange;

npm WARN saveError ENOENT: no such file or directory, open '/home/ubu/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/ubu/package.json'
npm WARN ubu No description
npm WARN ubu No repository field.
npm WARN ubu No README data
npm WARN ubu No license field.

+ opencv4nodejs@5.3.0
updated 1 package and audited 227 packages in 160.367s
found 0 vulnerabilities

Auto Build - Full Error Log

opencv4nodejs-installation-log.txt

ubuntu 18.04, node 10.16.3 (npm 6.9.0)

Manual Build - Environment Information

zi-l commented 4 years ago

The same error if install opencv4nodejs with git

git clone https://github.com/justadudewhohacks/opencv4nodejs.git
cd opencv4nodejs
npm install

opencv4nodejs-git-installation-log.txt

yiningzeng commented 4 years ago

@zi-l I have the same error. Have you solved it?

justadudewhohacks commented 4 years ago

You have to install the package in a directory, where a package.json exists. Run npm init -y before installing the package or create an empty package.json.

zi-l commented 4 years ago

@justadudewhohacks
I guess it's not related to package.json, since I had tried with the repository (refer to comment: install with git), which including a package.json in root dir.

Here are trials:

Evgsurf commented 4 years ago

The same UBUNTU 18.04 x64 NPM 6.13.1 NODE 12.13.1

from sudo npm install --save opencv4nodejs

P.S. python => Python 2.7.15+ (default, Oct 7 2019, 17:39:04) python3 => Python 3.6.9 (default, Nov 7 2019, 10:44:02) make => GNU Make 4.1

anselmobattisti commented 4 years ago

Same error here, any advise?

L30D3V commented 4 years ago

Did anyone solved this problem? Same error over here.

stiv-yakovenko commented 4 years ago

I have same error on lastest Ubuntu.

stiv-yakovenko commented 4 years ago

My rough guess for now is that g++ version matters.

stiv-yakovenko commented 4 years ago

@justadudewhohacks, what g++ version do you use?

UrielJavier commented 4 years ago

The node version matters, I think, with the last version of node doesn't works for me, on the other hand with the v8.... Works!!

hkozachkov commented 4 years ago

Modifying binding.gyp to disable the no-misleading-indentation warning worked for me.

The "cflags" section now reads

"cflags" : [
                        "-std=c++11",
                        "-Wno-misleading-indentation"
                ],

This seems to be the same issue as https://github.com/justadudewhohacks/opencv4nodejs/issues/649

chrischarles2002 commented 4 years ago

CentOS 7 | 7.8.2003 gcc | 4.8.5-39.el7 gcc-c++ | 4.8.5-39.el7
devtoolset-7-gcc-c++ | 7.3.1-5.16.el7
nodejs| 10.20.1 node-gyp | 6.1.0 npm| 6.14.4 appium-doctor | 1.15.1 python | 2.7.5-88.el7
make | 3.82-24.el7

======== This is still happening to me as well. I altered binding.gyp as per @hkozachkov2 , with same original outcome.

I'm not sure if I want to downgrade my node to version 8, in case it affects other elements for Appium deployment.

Anyone else found a solution as yet?

zi-l commented 4 years ago

@chrischarles2002 I'm facing the same problem, the newest Appium does not support node<=8. And also openstf does not support node > 8

zwebie commented 4 years ago

Would also appreciate a fix for this

zethyscythe commented 4 years ago

I'm facing the same issue, any update of this?

ezewer commented 4 years ago

Same issue here, working wrong with node version 12 (12.18.1), but working fine on node version 10 (10.16.3)

PauloFavero commented 4 years ago

I'm facing the same issue. Node version 14.4.0

waymond91 commented 4 years ago

+1

$ npm --version
3.5.2

$ nodejs --version
v8.10.0

$ g++ --version
g++ (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

As for misleading-indentation:

  CXX(target) Release/obj.target/opencv4nodejs/cc/core/Point.o
In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/include/opencv2/ml.hpp:1967:0,
                 from ../cc/machinelearning/machinelearning.h:3,
                 from ../cc/opencv4nodejs.cc:25:
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp: In function ‘int cv::ml::simulatedAnnealingSolver(SimulatedAnnealingSolverSystem&, double, double, double, size_t, double*, cv::RNG&)’:
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp:55:0: note: -Wmisleading-indentation is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
     return exchange;

Compile Error:

ERR! In file included from /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/include/opencv2/ml.hpp:1967:0,
                 from ../cc/machinelearning/machinelearning.h:3,
                 from ../cc/opencv4nodejs.cc:25:
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp: In function ‘int cv::ml::simulatedAnnealingSolver(SimulatedAnnealingSolverSystem&, double, double, double, size_t, double*, cv::RNG&)’:
/usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/include/opencv2/ml/ml.inl.hpp:55:0: note: -Wmisleading-indentation is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
     return exchange;
tejapriya-vardhineni commented 2 years ago

After a huge huge number of failures, in installing opencv4nodejs, i downgraded versions and tried installing it, for a temporary resolution. I have been facing the same issue from few days "missing indentation in ml.hpp" , finally the compile error disappeared, then the cmake error. It was a huge relief. Now I'm successfully able to use web camera in express.js. These are the versions i added in package.json. Make sure you delete package-lock.json and node-modules directory in your root folder. In package.json, add these versions.

`"express": "^4.16.3",
    "express-fileupload": "^1.2.1",
    "opencv4nodejs": "^4.7.3",
    "socket.io": "^2.1.1"

    steps :   npm init -y ; rm -rf node_modules package-lock.json ; npm install (assuming you have package.json)

Note : This is only a temporary fix to quickly get started with opencv4nodejs. If you need higher versions, I'm not sure. I have been facing issue with 5.1 version and above.

Successful installation :

CXX(target) Release/obj.target/opencv4nodejs/cc/modules/features2d/detectors/ORBDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/modules/features2d/detectors/SimpleBlobDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/modules/features2d/detectors/SimpleBlobDetectorParams.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/modules/xfeatures2d/xfeatures2d.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/modules/xfeatures2d/SIFTDetector.o
  CXX(target) Release/obj.target/opencv4nodejs/cc/modules/xfeatures2d/SURFDetector.o
  SOLINK_MODULE(target) Release/obj.target/opencv4nodejs.node
  COPY Release/opencv4nodejs.node
make: Leaving directory '/home/priya/expressapp/browse_try/node_modules/opencv4nodejs/build'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN expressapp@1.0.0 No repository field.

added 136 packages from 116 contributors and audited 136 packages in **748.026s**
found 0 vulnerabilities

All the best .

larryspace commented 2 years ago

Modifying binding.gyp to disable the no-misleading-indentation warning worked for me.

The "cflags" section now reads

"cflags" : [
                        "-std=c++11",
                        "-Wno-misleading-indentation"
                ],

This seems to be the same issue as #649

不知道在哪里设置这个,但是我导入环境变量就可以正常完成了:

export CXXFLAGS="-std=c++14 -Wno-c++11-narrowing -Wno-misleading-indentation"

希望对大家有所帮助~

larryspace commented 2 years ago

另外安装过程中遇到的其他问题

异常 npm ERR! throw new Error('library dir does not exist: ' + libDir)

尝试将nodejs版本降至v14.19.3 添加以下内容到package.json "opencv4nodejs": { "opencvIncludeDir": "/usr/local/Cellar/opencv/4.5.5_2/include", "opencvLibDir": "/usr/local/Cellar/opencv/4.5.5_2/lib", "opencvBinDir": "/usr/local/Cellar/opencv/4.5.5_2/bin" }

另外如果安装到ffmpeg报错,可以尝试卸载本地的ffmpeg再安装