我正在尝试更新最新的opencv formula(截至编写时,此公式安装opencv 2.4.7)以构建最新版本的opencv(2.4.8)。
我做的第一件事是brew edit opencv
,并将网址更改为“https://github.com/Itseez/opencv/archive/2.4.8.tar.gz”并更新校验和。我预计我可能不得不处理一些已建立的问题,但我看到的问题似乎是在公式运行时发生的。
具体来说,当我运行brew upgrade opencv
(或取消链接并运行brew install opencv
)时,我收到以下消息:
==> Downloading https://github.com/Itseez/opencv/archive/2.4.8.tar.gz
Already downloaded: /Library/Caches/Homebrew/opencv-2.4.8.tar.gz
==> Patching
patching file cmake/OpenCVFindOpenNI.cmake
Warning: Formula#python is deprecated and will go away shortly.
Error: undefined method `incdir' for #<PythonDependency: "python" []>
Please report this bug:
https://github.com/Homebrew/homebrew/wiki/troubleshooting
/usr/local/Library/Formula/opencv.rb:49:in `install'
/usr/local/Library/Homebrew/build.rb:165:in `install'
/usr/local/Library/Homebrew/formula.rb:272:in `brew'
/usr/local/Library/Homebrew/formula.rb:617:in `stage'
/usr/local/Library/Homebrew/resource.rb:63:in `unpack'
/usr/local/Library/Homebrew/extend/fileutils.rb:21:in `mktemp'
/usr/local/Library/Homebrew/resource.rb:60:in `unpack'
/usr/local/Library/Homebrew/resource.rb:53:in `stage'
/usr/local/Library/Homebrew/formula.rb:615:in `stage'
/usr/local/Library/Homebrew/formula.rb:267: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:80
Python似乎没有被加载。我也对弃用警告感到困惑;我发现的一切都表明python公式是我应该使用的公式。从这个link判断,depends_on :python
依赖似乎应该有效(当我尝试使用之前的2.4.7.1公式时,显然也是如此)。
供参考,以下是我的环境变量:
Apple_PubSub_Socket_Render=/tmp/launch-Ygtqzn/Render
CMD_DURATION=20.7s
COMMAND_MODE=unix2003
DISPLAY=/tmp/launch-a4CGwS/org.x:0
GEM_HOME=/Users/myname/.rvm/gems/ruby-1.9.3-p194
GEM_PATH=/Users/myname/.rvm/gems/ruby-1.9.3-p194:/Users/myname/.rvm/gems/ruby-1.9.3-p194@global
GREP_COLOR=97;45
GREP_OPTIONS=--color=auto
HOME=/Users/myname
LANG=en_CA.UTF-8
LOGNAME=myname
PATH=/usr/local/bin:/Users/myname/.rvm/gems/ruby-1.9.3-p194/bin:/Users/myname/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/myname/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/myname/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin:/Users/myname/.rvm/bin:/usr/local/heroku/bin
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig
PWD=/Users/myname/projects/forks/ruby-opencv
SHELL=/usr/local/bin/fish
SHLVL=1
SSH_AUTH_SOCK=/tmp/launch-lvn79S/Listeners
TERM=xterm-color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=273.1
TMPDIR=/var/folders/pv/pvvR8qgvGOCfd5dza+ZbVU+++TI/-Tmp-/
USER=myname
__CF_USER_TEXT_ENCODING=0x1F5:0:0
__fish_bin_dir=/usr/local/Cellar/fish/2.0.0/bin
__fish_datadir=/usr/local/Cellar/fish/2.0.0/share/fish
__fish_help_dir=/usr/local/Cellar/fish/2.0.0/share/doc/fish
__fish_sysconfdir=/usr/local/Cellar/fish/2.0.0/etc/fish
rvm_bin_path=/Users/myname/.rvm/bin
rvm_path=/Users/myname/.rvm
rvm_prefix=/Users/myname
rvm_version=1.25.3:master
和python(自制)版本
python --version #=>Python 2.7.6
brew doctor
输出给我一个关于乘客配置文件的警告(不应该影响opencv的构建)以及opencv取消链接的警告(我取消链接以尝试运行brew install opencv
)< / p>
提前感谢您的帮助。
答案 0 :(得分:2)
我有同样的错误。我不明白为什么在公式文件中没有正确定义“incdir”或其他变量。但我通过编辑opencv公式文件解决了这个错误,如下所示(直接设置每个路径)
(约50行)
DPYTHON_INCLUDE_DIR =的/ usr /本地/地窖/蟒/ 2.7.6 /框架/ Python.framework /版本/ 2.7 /包含/ python2.7
DPYTHON_LIBRARY =的/ usr /本地/地窖/蟒/ 2.7.6 /框架/ Python.framework /版本/ 2.7 / LIB / libpython2.7.dylib
DPYTHON_EXECUTABLE =的/ usr / local / bin中/蟒
答案 1 :(得分:1)
我通过回滚到早期的自制软件版本,然后安装opencv,然后回到当前版本来解决这个问题。
有关详细说明,请参阅此要点:https://gist.github.com/frederikhermans/8561382