环境:MacOS 10.12,CMake 3.9.0,python 2.7
我尝试使用此tutorial在Mac上编译Opencv,在我按照步骤8后,我得到如下错误:
/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
我试图解决&#39; QTKit / QTKit.h&#39;找不到文件&#39;,我跟着this。
一个解决方案是:
brew reinstall opencv3 --HEAD --with-python2 --with-ffmpeg --with-tbb --with-contrib
错误是
Error: opencv3: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/opencv3.rb:1: syntax error, unexpected '!', expecting end-of-input
?SDγ?qm?????5??...)?
^
另一个解决方案是使用$ brew编辑opencv3并注释以下4行:
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
然后我使用$ brew install opencv3 --with-contrib。但是发生了同样的错误。
Error: opencv3: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/opencv3.rb:1: syntax error, unexpected '!', expecting end-of-input
?SDγ?qm?????5??...)?
^