hybridgroup / gocv

Go package for computer vision using OpenCV 4 and beyond. Includes support for DNN, CUDA, OpenCV Contrib, and OpenVINO.
https://gocv.io
Other
6.68k stars 865 forks source link

[Please add to the installation procedure] GoCV depends on glob in macOS Mojave. #374

Closed LAKuEN closed 5 years ago

LAKuEN commented 5 years ago

Description

When I installed GoCV in macOS Mojave according to an installation guide, I faced an error.

$ brew uninstall opencv
Error: No such keg: /usr/local/Cellar/opencv

$ brew install hybridgroup/tools/opencv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
php@7.2
==> Updated Formulae
elasticsearch      kibana             kubernetes-helm    nss                php                php@7.1            rust               stunnel            xml-tooling-c
fx                 knot-resolver      logstash           pgweb              php@5.6            phpunit            shibboleth-sp      xml-security-c
==> Deleted Formulae
php@7.0
==> Tapping hybridgroup/tools
Cloning into '/usr/local/Homebrew/Library/Taps/hybridgroup/homebrew-tools'...
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 1 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
Tapped 2 formulae (31 files, 28.6KB).
==> Installing opencv from hybridgroup/tools
==> Installing dependencies for hybridgroup/tools/opencv: eigen, lame, libvpx, opus, sdl2, snappy, theora, x264, x265, xvid, ffmpeg, ilmbase, openexr, python@2 and tbb
==> Installing hybridgroup/tools/opencv dependency: eigen
==> Downloading https://homebrew.bintray.com/bottles/eigen-3.3.5.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring eigen-3.3.5.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/eigen/3.3.5: 487 files, 6.5MB
==> Installing hybridgroup/tools/opencv dependency: lame
==> Downloading https://homebrew.bintray.com/bottles/lame-3.100.mojave.bottle.tar.gz
######################################################################## 100.0%
...
==> Pouring opencv-4.0.0.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/opencv/4.0.0: 689 files, 216.8MB
==> Caveats
==> python@2
Pip and setuptools have been installed. To update them
  pip install --upgrade pip setuptools

You can install Python packages with
  pip install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

$ brew install pkgconfig
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pkg-config-0.29.2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.29.2: 11 files, 627.2KB

$ cd $GOPATH/src/gocv.io/x/gocv
$ go install gocv.io/x/gocv
$ go run ./cmd/version/main.go
dyld: Library not loaded: /usr/local/opt/glog/lib/libglog.0.3.5.dylib
  Referenced from: /usr/local/opt/opencv/lib/libopencv_sfm.4.0.dylib
  Reason: image not found
signal: abort trap

So when I tried installing glog, GoCV worked.

$ brew install glog
==> Installing dependencies for glog: gflags
==> Installing glog dependency: gflags
==> Downloading https://homebrew.bintray.com/bottles/gflags-2.2.2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gflags-2.2.2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/gflags/2.2.2: 24 files, 330.5KB
==> Installing glog
==> Downloading https://homebrew.bintray.com/bottles/glog-0.3.5_3.mojave.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring glog-0.3.5_3.mojave.bottle.1.tar.gz
🍺  /usr/local/Cellar/glog/0.3.5_3: 21 files, 231.6KB

$ go run ./cmd/version/main.go

gocv version: 0.18.0
opencv lib version: 4.0.0

Steps to Reproduce

  1. Clean install macOS Mojave.
  2. Install golang with installer for macOS.
  3. Install GoCV according to installation guide.

My Environment

deadprogram commented 5 years ago

Seems like we need to further update https://github.com/hybridgroup/homebrew-tools/blob/master/opencv.rb

LAKuEN commented 5 years ago

Thanks for checking the issue. I cannot read Ruby code, but it seems to need to add depends_on glog to the next line of this line.

I ignorance about Ruby, so could you add the line instead?

deadprogram commented 5 years ago

This should now be addressed by https://github.com/hybridgroup/homebrew-tools/commit/76eff206243edacd0a321a1e72a12e479bad76d6

Thanks for helping get it resolved @LAKuEN

Now closing this issue, please reopen if needed.