我正在尝试使用brew安装opencv库。 我试过了:
sudo brew install opencv
这是输出:
user$ sudo brew install opencv
sudo: /var/db/sudo writable by non-owner (040777), should be mode 0700
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
/usr/local/Library/Homebrew/global.rb:64: warning: Insecure world writable dir /opt/local in PATH, mode 040777
/usr/local/bin/brew:74: warning: Insecure world writable dir /opt/local in PATH, mode 040777
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
/usr/local/Library/Homebrew/build.rb:7: warning: Insecure world writable dir /opt/local in PATH, mode 040777
==> Downloading http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2
File already downloaded in /Library/Caches/Homebrew
==> Patching
patching file modules/highgui/src/grfmt_exr.hpp
==> cmake . -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/opencv/2.3.1a' -DCMAKE_BUILD_TYPE=None -Wno-dev -DPYTHON_LIBRARY='/System/Library/Frameworks/Python.framework/Versions/2.7/Python' -DP
==> make
Scanning dependencies of target opencv_core
[ 1%] [ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/arithm.o
Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/alloc.o
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/array.o
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/cmdparser.o
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/convert.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/copy.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/datastructs.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/drawing.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/dxt.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/lapack.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/mathfuncs.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/matmul.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/matop.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/matrix.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/out.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/persistence.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/precomp.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/rand.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/stat.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/tables.o
Linking CXX shared library ../../lib/libopencv_core.dylib
[ 5%] Built target opencv_core
Scanning dependencies of target opencv_flann
[ 6%] Building CXX object modules/flann/CMakeFiles/opencv_flann.dir/src/flann.o
Scanning dependencies of target opencv_imgproc
[ 6%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.o
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/flann.cpp:29:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/precomp.hpp:17:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/all_indices.h:42:
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/lsh_index.h:89:81: error: no matching constructor for initialization of 'cvflann::LshIndexParams'
LshIndex(const Matrix<ElementType>& input_data, const IndexParams& params = LshIndexParams(),
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/lsh_index.h:59:5: note: candidate constructor not viable: requires 3 arguments, but 0 were provided
LshIndexParams(unsigned int table_number, unsigned int key_size, unsigned int multi_probe_level)
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/lsh_index.h:57:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
struct LshIndexParams : public IndexParams
^
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/flann.cpp:29:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/precomp.hpp:10:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/index_testing.h:39:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/nn_index.h:39:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/params.h:33:
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:88:67: error: call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup
virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(*src); }
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:136:44: note: in instantiation of member function 'cdiggins::anyimpl::big_any_policy<cdiggins::anyimpl::empty_any>::print' requested here
static typename choose_policy<T>::type policy;
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:159:18: note: in instantiation of function template specialization 'cdiggins::anyimpl::get_policy<cdiggins::anyimpl::empty_any>' requested here
: policy(anyimpl::get_policy<anyimpl::empty_any>()), object(NULL)
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:276:22: note: 'operator<<' should be declared prior to the call site or in namespace 'cdiggins::anyimpl'
inline std::ostream& operator <<(std::ostream& out, const any& any_val)
^
2 errors generated.
make[2]: *** [modules/flann/CMakeFiles/opencv_flann.dir/src/flann.o] Error 1
make[1]: *** [modules/flann/CMakeFiles/opencv_flann.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/approx.o
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/canny.o
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/color.o
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/contours.o
[ 8%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/convhull.o
[ 8%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/corner.o
[ 8%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/cornersubpix.o
[ 8%] [ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/deriv.o
Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/distransform.o
[ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/emd.o
[ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/featureselect.o
[ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/featuretree.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/filter.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/floodfill.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/geometry.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/grabcut.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/histogram.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/hough.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/imgwarp.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/inpaint.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/kdtree.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/linefit.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/lsh.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/matchcontours.o
[ 12%] [ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/moments.o
Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/morph.o
[ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/precomp.o
[ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/pyramids.o
[ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/pyrsegmentation.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/rotcalipers.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/samplers.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/segmentation.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/shapedescr.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/smooth.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/spilltree.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/subdivision2d.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/sumpixels.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/tables.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/templmatch.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/thresh.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/undistort.o
[ 17%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/utils.o
Linking CXX shared library ../../lib/libopencv_imgproc.dylib
[ 17%] Built target opencv_imgproc
make: *** [all] Error 2
CMakeCache.txt was copied to /Users/turchijacopo/Library/Logs/Homebrew
==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/opencv.rb#L76
==> Environment
HOMEBREW_VERSION: 0.8.1
HEAD: 3b771d09e48f4dfa88ef4c5d32f3b84ca2ae18ec
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
Hardware: dual-core 64-bit penryn
OS X: 10.7.3
Kernel Architecture: x86_64
Xcode: 4.3.1
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2336
Clang: 3.0 build 211
MacPorts or Fink? /opt/local/bin/port
X11: /usr/X11
System Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Which Perl: /usr/bin/perl
Which Python: /usr/bin/python
Which Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
==> Build Flags
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments
MAKEFLAGS: -j2
Error: Failed executing: make
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/10862
Otherwise, please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
我能做什么?
答案 0 :(得分:3)
您可以从阅读错误消息开始:
这些现有问题可能对您有所帮助: https://github.com/mxcl/homebrew/issues/10862
这可能不是你的问题,但一个想法是尝试安装OpenCV 32位:
brew install opencv --32-bit
如果这不起作用:
请报告错误: https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
您可以随时下载OpenCV源代码并自行编译。这就是我在Mac OS X上所做的。