使用Brew安装OpenCV始终无法完成

10

所以我试图使用Homebrew安装opencv,但是它不起作用。 我使用了brew tap homebrew/science,然后使用brew install opencv

发生的情况是:

==> 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

然后它就停不下来了,我已经运行了接近一个小时。终端窗口顶部的任务(你知道,在一般情况下会显示bash)不断快速变化,通常会变成"ruby"之类的东西,但在此之后没有任何输出。

有什么想法吗?谢谢。

2个回答

17
请注意,此时实际上正在编译GCC,这需要很长时间。默认情况下,Homebrew提供预构建的二进制安装包,因此奇怪的是为什么没有使用它们。您的环境是否设置为从源代码构建所有内容?您可以尝试 brew install gcc --force-bottle

1
请注意,在运行“brew install gcc --force-bottle”之后,您仍需要运行“brew install opencv”。 - ninjaPixel

9

我看到了这个有相同问题的提问 -

brew tap homebrew/science
brew install opencv

我开始安装一些依赖项,一切顺利,直到出现了gcc,我得到了以下的错误信息:

==> 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

这个过程持续了3个小时,最后我感到很烦并将其关闭。

解决方案: 使用brew bottle: brew install gcc --force-bottle。 它运行得很好,但是会出现以下警告:

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

我在使用OpenMP时还没有遇到任何问题。希望这能帮助其他人。 我正在运行带有OSX El Capitan的MBP 13“(2011年底版)。 (它很旧,这可能解释了 make 的冗长时间)。 首先感谢@IanLancaster提供的解决方案,但我想详细说明一下注意事项。


谢谢!201分钟后,gcc在我的MBP 2012上完成了编译。 - MethodMan
好像这个警告可能不再适用(在2020年末)?看起来它已经在我的系统上安装了Open-MPI。 - mpowered

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接