问题
So I'm trying to install opencv using Homebrew but it isn't working. I used brew tap homebrew/science
and then brew install opencv
What happens is:
==> Installing opencv from homebrew/homebrew-science
==> Installing dependencies for homebrew/science/opencv: gcc, eigen, jpeg, libpng, libtiff, ilmbase, openexr, homebrew/python/numpy
==> Installing homebrew/science/opencv dependency: gcc
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-5.1.0/gcc-5.1.0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc-5.1.0.tar.bz2
==> Patching
patching file gcc/jit/Make-lang.in
==> ../configure --build=x86_64-apple-darwin13.4.0 --prefix=/usr/local/Cellar/gcc/5.1.0 --libdir=/usr/local/Cellar/gcc/5.1.0/lib/gcc/5 --enable-langua
==> make bootstrap
And then it just doesn't stop, I've run it for close to an hour. The task on the top of the terminal window (you know, where it says bash generally) keeps rapidly changing, often to things like "ruby" but nothing gets outputted after this point.
Any ideas? Thanks.
回答1:
Note that it's actually compiling GCC at that point, which is expected to take a long time. Homebrew does provide pre-built binary bottles by default, so it's curious those aren't being used. Is your environment set to build everything from source? You could try brew install gcc --force-bottle
回答2:
I came across this question with the same problem -
brew tap homebrew/science
brew install opencv
started installing a bunch of dependencies, which worked great until gcc
started, where I got:
==> Installing homebrew/science/opencv dependency: gcc
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
==> Downloading from http://gnu.mirror.iweb.com/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
######################################################################## 100.0%
==> Patching
patching file gcc/jit/Make-lang.in
patching file gcc/jit/jit-playback.c
Hunk #1 succeeded at 2459 with fuzz 2 (offset 43 lines).
==> ../configure --build=x86_64-apple-darwin15.0.0 --prefix=/usr/local/Cellar/gcc/5.2.0 --libdir=/usr/loc
==> make bootstrap
This process went on for 3 hours before I got annoyed and killed it.
Solution:
Use the brew bottle:
brew install gcc --force-bottle
.
It works a treat but does give the following caveat:
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to
brew reinstall gcc --without-multilib
I haven't run into any problems with OpenMP yet. Hope this helps somebody else.
Running MBP 13" (Late 2011) with OSX El Capitain. (It's old, which probably explains the lengthy make
s). Credit to @IanLancaster for getting the solution first, but I thought I would elaborate with the caveats.
来源:https://stackoverflow.com/questions/30998890/installing-opencv-with-brew-never-finishes