2

我刚刚将我的 Mac 更新为 Mountain Lion,将 XCode 更新为 ver4.4

出现了几个围绕无法解决 #include 的问题。所以我决定使用 Homebrew 删除并重新安装我的 python 和 opencv 库。

但是,在安装 Python 之后,我在使用 home-brew 安装 opencv 时遇到了错误。

有谁知道如何解决这个问题?附件是运行的输出日志

brew install -v opencv

/usr/bin/env python -c import numpy
==> Downloading http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.2/OpenCV-2.4.2.tar.bz2
Already downloaded: /Library/Caches/Homebrew/opencv-2.4.2.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/opencv-2.4.2.tar.bz2
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv/2.4.2 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev -DPYTHON_LIBRARY='/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Python' -DPYTHON_INCLUDE_DIR='/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Headers' -DPYTHON_PACKAGES_PATH='/usr/local/Cellar/opencv/2.4.2/lib/python2.7/site-packages'
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv/2.4.2 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev -DPYTHON_LIBRARY='/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Python' -DPYTHON_INCLUDE_DIR='/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Headers' -DPYTHON_PACKAGES_PATH='/usr/local/Cellar/opencv/2.4.2/lib/python2.7/site-packages'
-- The CXX compiler identification is Clang 4.0.0
-- The C compiler identification is Clang 4.0.0
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Extracting svn version, please wait...
-- SVNVERSION: exported
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Performing Test HAVE_C_WNO_ATTRIBUTES
-- Performing Test HAVE_C_WNO_ATTRIBUTES - Success
-- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES
-- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES - Success
-- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES
-- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES - Success
-- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS
-- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS - Success
-- Looking for assert.h
-- Looking for assert.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for io.h
-- Looking for io.h - not found
-- Looking for jbg_newlen
-- Looking for jbg_newlen - not found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for search.h
-- Looking for search.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_VARIABLE
-- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_VARIABLE - Success
-- Performing Test HAVE_C_WNO_UNDEF
-- Performing Test HAVE_C_WNO_UNDEF - Success
-- Performing Test HAVE_C_WNO_UNUSED
-- Performing Test HAVE_C_WNO_UNUSED - Success
-- Performing Test HAVE_C_WNO_SIGN_COMPARE
-- Performing Test HAVE_C_WNO_SIGN_COMPARE - Success
-- Performing Test HAVE_C_WNO_CAST_ALIGN
-- Performing Test HAVE_C_WNO_CAST_ALIGN - Success
-- Performing Test HAVE_C_WNO_SHADOW
-- Performing Test HAVE_C_WNO_SHADOW - Success
-- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED
-- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED - Success
-- Performing Test HAVE_C_WNO_POINTER_TO_INT_CAST
-- Performing Test HAVE_C_WNO_POINTER_TO_INT_CAST - Success
-- Performing Test HAVE_C_WNO_INT_TO_POINTER_CAST
-- Performing Test HAVE_C_WNO_INT_TO_POINTER_CAST - Success
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER
-- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER - Success
-- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION
-- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION - Success
-- Performing Test HAVE_C_WNO_UNINITIALIZED
-- Performing Test HAVE_C_WNO_UNINITIALIZED - Success
-- checking for module 'libdc1394-2'
--   package 'libdc1394-2' not found
-- checking for module 'libdc1394'
--   package 'libdc1394' not found
-- checking for module 'libavcodec'
--   package 'libavcodec' not found
-- checking for module 'libavformat'
--   package 'libavformat' not found
-- checking for module 'libavutil'
--   package 'libavutil' not found
-- checking for module 'libswscale'
--   package 'libswscale' not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Found CUDA: /usr/local/cuda (found suitable version "4.1", required is "4.1") 
-- CUDA detected: 4.1
-- CUDA NVCC target flags: -gencode;arch=compute_11,code=sm_11;-gencode;arch=compute_12,code=sm_12;-gencode;arch=compute_13,code=sm_13;-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_20,code=compute_20
-- Found PythonInterp: /usr/local/bin/python2 (found suitable version "2.7.3", required is "2.0") 
-- Found PythonLibs: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Python (found suitable version "2.7.3", required is "2.7.3") 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sphinx
-- Performing Test HAVE_CXX_WNO_UNDEF
-- Performing Test HAVE_CXX_WNO_UNDEF - Success
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success
-- 
-- General configuration for OpenCV 2.4.2 =====================================
-- 
--   Platform:
--     Host:                        Darwin 12.0.0 i386
--     CMake:                       2.8.8
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               None
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/clang++
--     C++ flags (Release):         -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8    -O3 -DNDEBUG 
--     C++ flags (Debug):           -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8    -g 
--     C Compiler:                  /usr/bin/clang
--     C flags (Release):           -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8    -O3 -DNDEBUG 
--     C flags (Debug):             -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8    -g 
--     Linker flags (Release):      -L/usr/local/Cellar/gettext/0.18.1.1/lib -L/usr/local/lib
--     Linker flags (Debug):        -L/usr/local/Cellar/gettext/0.18.1.1/lib -L/usr/local/lib
--     Precompiled headers:         NO
-- 
--   OpenCV modules:
--     To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree gpu legacy photo python stitching ts videostab
--     Disabled:                    -
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera java world
-- 
--   GUI: 
--     QT 4.x:                      NO
--     Cocoa:                       YES
--     OpenGL support:              NO
-- 
--   Media I/O: 
--     ZLib:                        build (ver 1.2.6)
--     JPEG:                        build (ver 62)
--     PNG:                         build (ver 1.5.9)
--     TIFF:                        build (ver 42 - 4.0.1)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     NO
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      NO
--       codec:                     NO
--       format:                    NO
--       util:                      NO
--       swscale:                   NO
--       gentoo-style:              NO
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     QuickTime:                   NO
--     QTKit:                       YES
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use TBB:                     NO
--     Use Cuda:                    YES (ver 4.1)
--     Use Eigen:                   NO
-- 
--   NVIDIA CUDA:                   (ver 4.1)
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     NVIDIA GPU arch:             11 12 13 20 21
--     NVIDIA PTX archs:            11 12 13 20 21
--     NVIDIA GPU features:         11 12 13 20 20 20
-- 
--   Python:
--     Interpreter:                 /usr/local/bin/python2 (ver 2.7.3)
--     Libraries:                   /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Python (ver 2.7.3)
--     numpy:                       /Library/Python/2.7/site-packages/numpy/core/include (ver 1.6.2)
--     packages path:               /usr/local/Cellar/opencv/2.4.2/lib/python2.7/site-packages
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           /usr/texbin/pdflatex
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     Examples:                    NO
-- 
--   Install path:                  /usr/local/Cellar/opencv/2.4.2
-- 
--   cvconfig.h is in:              /tmp/homebrew-opencv-2.4.2-3DWY/OpenCV-2.4.2
-- -----------------------------------------------------------------
-- 
CMake Warning at CMakeLists.txt:785 (message):
  The source directory is the same as binary directory.  "make clean" may
  damage the source tree


-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/homebrew-opencv-2.4.2-3DWY/OpenCV-2.4.2
==> make
make 
Scanning dependencies of target zlib
Scanning dependencies of target libjpeg
[  0%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/adler32.c.o
[  0%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcapimin.c.o
[  0%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/compress.c.o
[  0%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcapistd.c.o
[  0%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/crc32.c.o
[  1%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jccoefct.c.o
[  1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/deflate.c.o
[  1%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jccolor.c.o
[  1%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcdctmgr.c.o
[  1%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jchuff.c.o
[  1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzclose.c.o
[  1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzlib.c.o
[  1%] [  1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzread.c.o
Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcinit.c.o
[  1%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcmainct.c.o
[  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzwrite.c.o
[  2%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcmarker.c.o
[  2%] [  2%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inflate.c.o
Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcmaster.c.o
[  3%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcomapi.c.o
[  3%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcparam.c.o
[  3%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcphuff.c.o
[  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/infback.c.o
[  3%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcprepct.c.o
[  3%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcsample.c.o
[  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inftrees.c.o
[  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inffast.c.o
[  3%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jctrans.c.o
[  3%] [  3%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/trees.c.o
Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdapimin.c.o
[  3%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdapistd.c.o
[  4%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdatadst.c.o
[  4%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/uncompr.c.o
[  4%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdatasrc.c.o
[  5%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/zutil.c.o
[  5%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdcoefct.c.o
Linking C static library ../lib/libzlib.a
[  5%] Built target zlib
Scanning dependencies of target libjasper
[  5%] [  5%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdcolor.c.o
Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_cm.c.o
[  5%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jddctmgr.c.o
[  5%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdhuff.c.o
[  5%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_debug.c.o
[  5%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_getopt.c.o
[  5%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdinput.c.o
[  5%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_icc.c.o
[  5%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdmainct.c.o
[  6%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdmarker.c.o
[  6%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_iccdata.c.o
[  6%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_image.c.o
[  6%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdmaster.c.o
[  6%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdmerge.c.o
[  6%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdphuff.c.o
[  6%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_init.c.o
[  6%] [  7%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdpostct.c.o
Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_malloc.c.o
[  7%] [  7%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_seq.c.o
Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdsample.c.o
[  7%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdtrans.c.o
[  7%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_stream.c.o
[  8%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jerror.c.o
[  8%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jfdctflt.c.o
[  8%] [  8%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_string.c.o
Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jfdctfst.c.o
[  8%] [  8%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_tmr.c.o
Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jfdctint.c.o
[  8%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_tvp.c.o
[  8%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jidctflt.c.o
[  8%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_version.c.o
[  8%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jidctfst.c.o
[  8%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jp2_cod.c.o
[  8%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jidctint.c.o
[  8%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jidctred.c.o
[  9%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jp2_dec.c.o
[ 10%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jmemansi.c.o
[ 10%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jp2_enc.c.o
[ 10%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jmemmgr.c.o
[ 10%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_bs.c.o
[ 10%] [ 10%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jquant1.c.o
Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_cs.c.o
[ 10%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jquant2.c.o
[ 10%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_dec.c.o
[ 10%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jutils.c.o
[ 10%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/transupp.c.o
[ 10%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_enc.c.o
Linking C static library ../lib/liblibjpeg.a
[ 10%] Built target libjpeg
[ 10%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_math.c.o
[ 10%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_mct.c.o
[ 11%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_mqcod.c.o
[ 11%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_mqdec.c.o
[ 11%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_mqenc.c.o
Scanning dependencies of target libpng
[ 11%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/png.c.o
[ 11%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_qmfb.c.o
[ 11%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngerror.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngget.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngmem.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngpread.c.o
[ 12%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_t1cod.c.o
[ 12%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_t1dec.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngread.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngrio.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngrtran.c.o
[ 12%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_t1enc.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngrutil.c.o
[ 12%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_t2cod.c.o
[ 12%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngset.c.o
[ 13%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_t2dec.c.o
[ 13%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_t2enc.c.o
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngtest.c.o
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngtrans.c.o
[ 14%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_tagtree.c.o
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwio.c.o
[ 14%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_tsfb.c.o
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwrite.c.o
[ 14%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jpc_util.c.o
Linking C static library ../lib/liblibjasper.a
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwtran.c.o
[ 14%] Built target libjasper
[ 14%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_matrix_operations.cu.o
[ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngwutil.c.o
/tmp/homebrew-opencv-2.4.2-3DWY/OpenCV-2.4.2/modules/core/src/cuda/matrix_operations.cu:0: error: bad value (native) for -march= switch
/tmp/homebrew-opencv-2.4.2-3DWY/OpenCV-2.4.2/modules/core/src/cuda/matrix_operations.cu:0: error: bad value (native) for -mtune= switch
CMake Error at cuda_compile_generated_matrix_operations.cu.o.cmake:200 (message):
  Error generating
  /tmp/homebrew-opencv-2.4.2-3DWY/OpenCV-2.4.2/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_matrix_operations.cu.o


make[2]: *** [modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_matrix_operations.cu.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking C static library ../lib/liblibpng.a
[ 14%] Built target libpng
make: *** [all] Error 2
==> Exit Status: 2
https://github.com/mxcl/master/blob/master/Library/Formula/opencv.rb#L70
==> Build Environment
HOMEBREW_VERSION: 0.9.2
HEAD: 92393f1526b443e86b78629fae795eb4d8e3a6a5
CPU: dual-core 64-bit penryn
OS X: 10.8-x86_64
Xcode: 4.4
CLT: 4.4.0.0.1.1249367152
X11: 2.7.2 @ /opt/X11
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8
CPPFLAGS: -I/usr/local/Cellar/gettext/0.18.1.1/include -isystem /usr/local/include
LDFLAGS: -L/usr/local/Cellar/gettext/0.18.1.1/lib -L/usr/local/lib
MACOSX_DEPLOYMENT_TARGET: 10.8
MAKEFLAGS: -j2
Error: Failed executing: make (opencv.rb:70)
These existing issues may help you:
    https://github.com/mxcl/homebrew/issues/13603
Otherwise, this may help you fix or report the issue:
    https://github.com/mxcl/homebrew/wiki/bug-fixing-checklist
4

1 回答 1

2

看起来问题来自编译器标志 -march=native。

我的解决方案是编辑 opencv 的自制配方以覆盖编译标志。

brew edit opencv

只需在“def install”部分的末尾添加以下语句

args << "-DCMAKE_CXX_FLAGS='-Os -w -pipe -Qunused-arguments -mmacosx-version-min=10.8'"
args << "-DCMAKE_C_FLAGS='-Os -w -pipe -Qunused-arguments -mmacosx-version-min=10.8'"

就在之前

system 'cmake', '.', *args
system "make"
system "make install"
于 2012-08-12T16:43:05.713 回答