0

Environment:MacOS 10.12, CMake 3.9.0, python 2.7

I try to compile Opencv on mac using this tutorial,and after I followed Step 8, I got the error as follows:

/Users/niceycb/opencv/modules/videoio/src/cap_qtkit.mm:46:9: fatal error: 
      'QTKit/QTKit.h' file not found
#import <QTKit/QTKit.h>
        ^
1 error generated.
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_qtkit.mm.o] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 35%] Linking CXX static library ../../lib/libopencv_shape.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../lib/libopencv_shape.a(precomp.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../lib/libopencv_shape.a(precomp.cpp.o) has no symbols
[ 35%] Built target opencv_shape
make: *** [all] Error 2

And I tried to solve ''QTKit/QTKit.h' file not found', I followed this.

One solution is:

brew reinstall opencv3 --HEAD --with-python2 --with-ffmpeg --with-tbb --with-contrib

The error is

Error: opencv3: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/opencv3.rb:1: syntax error, unexpected '!', expecting end-of-input
?SDγ?qm?????5??...)?
            ^

Another solution is that using $brew edit opencv3 and commenting the following 4 lines:

if build.with?("python3") && build.with?("python")
  # Opencv3 Does not support building both Python 2 and 3 versions
  odie "opencv3: Does not support building both Python 2 and 3 wrappers"
end

Then I use $ brew install opencv3 --with-contrib. But the same error occurred.

Error: opencv3: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/opencv3.rb:1: syntax error, unexpected '!', expecting end-of-input
?SDγ?qm?????5??...)?
            ^
Nice.Y
  • 21
  • 2
  • Why not just compile the source from `OpenCV` and use `cmake`? – l'L'l Aug 09 '17 at 02:59
  • @ l'L'l I'm quite new about that, I think the tutorial I followed does compile the source from OpenCV and use cmake. Tutorial link:http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/ – Nice.Y Aug 09 '17 at 03:51
  • The tutorial seems like it's way more steps than it needs to be; it's quite simple to just download the source from the official site and compile it. What is the intended usage for OpenCV, are you planning on using it with Xcode, building an app, etc? – l'L'l Aug 09 '17 at 03:56
  • @ l'L'l Actually,I'm following this project guide to test model.(https://github.com/imatge-upc/activitynet-2016-cvprw/blob/master/misc/step_by_step_guide.md) What should I do first is to build an environment. This model require to have a Python virtual environment,and the page asserts that the opencv installation install the Python package. The tutorial I followed to build opencv meets my requirements. – Nice.Y Aug 09 '17 at 04:15
  • Well, it appears you were using the wrong tutorial. I think you want this one instead: http://www.pyimagesearch.com/2016/11/28/macos-install-opencv-3-and-python-2-7/ – l'L'l Aug 09 '17 at 04:27
  • Yeah,I'm too careless!Thanks a lot, I really appreciate it. – Nice.Y Aug 09 '17 at 04:32

0 Answers0