1

I made the mistake of updating to os x 10.9, too early in the morning and way to soon after its release. Then to compound it i brew uninstalled opencv then tried to reinstall it so it would use a new library. now it fails.

THis is the wonderfully helpful:) error message and backtrace. I can't find anything that makes sense as to why it's failing.

any pointers would be much appreciated.

enter code here
/usr/local/Library/ENV/4.3/c++     -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -dynamiclib -Wl,-headerpad_max_install_names   -compatibility_version 2.4.0 -current_version 2.4.6 -o ../../lib/libopencv_video.2.4.6.dylib -install_name /tmp/opencv-IuRF/opencv-2.4.6.1/macbuild/lib/libopencv_video.2.4.dylib
cmakeFiles/opencv_video.dir/src/bgfg_gaussmix.cpp.o
cmakeFiles/opencv_video.dir/src/bgfg_gaussmix2.cpp.o
cmakeFiles/opencv_video.dir/src/bgfg_gmg.cpp.o
cmakeFiles/opencv_video.dir/src/camshift.cpp.o
cmakeFiles/opencv_video.dir/src/kalman.cpp.o
cmakeFiles/opencv_video.dir/src/lkpyramid.cpp.o
cmakeFiles/opencv_video.dir/src/motempl.cpp.o
cmakeFiles/opencv_video.dir/src/optflowgf.cpp.o
cmakeFiles/opencv_video.dir/src/precomp.cpp.o
cmakeFiles/opencv_video.dir/src/simpleflow.cpp.o
cmakeFiles/opencv_video.dir/src/tvl1flow.cpp.o
cmakeFiles/opencv_video.dir/src/video_init.cpp.o ../../lib/libopencv_core.2.4.6.dylib ../../lib/libopencv_imgproc.2.4.6.dylib -framework OpenCL ../../lib/libopencv_core.2.4.6.dylib /usr/lib/libz.dylib -framework OpenCL 
cd /tmp/opencv-IuRF/opencv-2.4.6.1/macbuild/modules/video && /usr/local/Cellar/cmake/2.8.12/bin/cmake -E
cmake_symlink_library ../../lib/libopencv_video.2.4.6.dylib ../../lib/libopencv_video.2.4.dylib ../../lib/libopencv_video.dylib
/usr/local/Cellar/cmake/2.8.12/bin/cmake -E
cmake_progress_report /tmp/opencv-IuRF/opencv-2.4.6.1/macbuild/CMakeFiles  97 98
[ 42%] Built target opencv_video
make: *** [all] Error 2


/usr/local/Library/Homebrew/formula.rb:606:in `system'
/usr/local/Library/Formula/opencv.rb:60:in `install'
/usr/local/Library/Homebrew/extend/fileutils.rb:33:in `mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:121:in `chdir'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:121:in `chdir'
/usr/local/Library/Homebrew/extend/fileutils.rb:32:in `mkdir'
/usr/local/Library/Formula/opencv.rb:58:in `install'
/usr/local/Library/Homebrew/build.rb:165:in `install'
/usr/local/Library/Homebrew/formula.rb:266:in `brew'
/usr/local/Library/Homebrew/formula.rb:617:in `stage'
/usr/local/Library/Homebrew/resource.rb:56:in `stage'
/usr/local/Library/Homebrew/extend/fileutils.rb:21:in `mktemp'
/usr/local/Library/Homebrew/resource.rb:53:in `stage'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `stage'
/usr/local/Library/Homebrew/formula.rb:615:in `stage'
/usr/local/Library/Homebrew/formula.rb:261:in `brew'
/usr/local/Library/Homebrew/build.rb:144:in `install'
/usr/local/Library/Homebrew/build.rb:45:in `main'
/usr/local/Library/Homebrew/build.rb:12
/usr/local/Library/Formula/opencv.rb:66e here
4

2 回答 2

0

Try the brew installed python if you're not using it already. Or set env to standard.

I've git mine compiling aok, here's my script (I link with ffmpeg for video writing)

My problem is linking to it from nodejs, there's something off with linking that used to work in 10.8x.

require 'formula'

class Opencv < Formula
  homepage 'http://opencv.org/'
  url 'http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.6.1/opencv-2.4.6.1.tar.gz'
  sha1 'e015bd67218844b38daf3cea8aab505b592a66c0'

  option '64-bit'
  option 'with-qt',  'Build the Qt4 backend to HighGUI'
  option 'with-tbb', 'Enable parallel code in OpenCV using Intel TBB'
  # option 'without-opencl', 'Disable gpu code in OpenCV using OpenCL'
  option 'with-opencl', 'enable gpu code in OpenCV using OpenCL'
  option 'with-ffmpeg', 'enable ffmpeg'

  depends_on 'cmake' => :build
  depends_on 'pkg-config' => :build
  depends_on 'numpy' => :python
  depends_on :python

  depends_on 'eigen'   => :optional
  depends_on 'libtiff' => :optional
  depends_on 'jasper'  => :optional
  depends_on 'tbb'     => :optional
  depends_on 'qt'      => :optional
  depends_on :libpng

  # Can also depend on ffmpeg, but this pulls in a lot of extra stuff that
  # you don't need unless you're doing video analysis, and some of it isn't
  # in Homebrew anyway. Will depend on openexr if it's installed.
  depends_on 'ffmpeglatest'

  def install
    args = std_cmake_args + %W[
      -DCMAKE_OSX_DEPLOYMENT_TARGET=
      -DWITH_CUDA=OFF
      -DBUILD_ZLIB=OFF
      -DBUILD_TIFF=OFF
      -DBUILD_PNG=OFF
      -DBUILD_JPEG=OFF
      -DBUILD_JASPER=OFF
      -DBUILD_TESTS=OFF
      -DBUILD_PERF_TESTS=OFF
      -DPYTHON_INCLUDE_DIR='#{python.incdir}'
      -DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'
      -DPYTHON_EXECUTABLE='#{python.binary}'
    ]

    if build.build_32_bit?
      args << "-DCMAKE_OSX_ARCHITECTURES=i386"
      args << "-DOPENCV_EXTRA_C_FLAGS='-arch i386 -m32'"
      args << "-DOPENCV_EXTRA_CXX_FLAGS='-arch i386 -m32'"
    end
    args << '-DWITH_QT=ON' if build.with? 'qt'
    args << '-DWITH_TBB=ON' if build.with? 'tbb'
    # OpenCL 1.1 is required, but Snow Leopard and older come with 1.0
    # args << '-DWITH_OPENCL=OFF' if build.without? 'opencl' or MacOS.version < :lion
    # args << '-DWITH_FFMPEG=OFF' unless build.with? 'ffmpeg'

    args << '..'
    mkdir 'macbuild' do
      system 'cmake', *args
      system "make"
      system "make install"
    end
  end


  def caveats
    python.standard_caveats if python
  end
end
于 2013-10-30T16:48:05.220 回答
0

You can try to install opencv from homebrew, I met the same problem with cmake in my 10.9 and finally I found the solution from Chris Muktar. Here are the steps:

  1. Make sure xcode-select --install Xcode command line tools 5.0.1 are installed.
  2. Install python using brew - brew install python.
  3. pip update
  4. pip install numpy
  5. brew linkapps
  6. Add export PYTHONPATH=/usr/local/Cellar/opencv/2.4.6.1/lib/python2.7/site-packages:$PYTHONPATH to .bash_profile
  7. brew install opencv

In the last step I came across the Error: No available formula for opencv. In this case, you should first run the command brew tap homebrew/science.

Good Luck

于 2013-11-12T10:08:32.093 回答