user3588841
user3588841

Reputation: 189

OpenCV with Ruby error

I am using the ruby-opencv gem to work with opencv on ruby. I used Homebrew for installing opencv. installation of opencv and ruby were successful, but I get the following error when I try running any example -

/usr/local/Cellar/ruby/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/ruby-opencv-0.0.14/opencv.bundle, 9): Library not loaded: /usr/local/lib/libpng16.16.dylib (LoadError)
  Referenced from: /usr/local/lib/libopencv_highgui.2.4.dylib
  Reason: Incompatible library version: libopencv_highgui.2.4.dylib requires version 34.0.0 or later, but libpng16.16.dylib provides version 33.0.0 - /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/ruby-opencv-0.0.14/opencv.bundle
    from /usr/local/Cellar/ruby/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/ruby/gems/2.2.0/gems/ruby-opencv-0.0.14/lib/opencv.rb:11:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /usr/local/Cellar/ruby/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /usr/local/Cellar/ruby/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from opencv.rb:1:in `<main>'

What do I do to fix this?

Upvotes: 0

Views: 932

Answers (1)

cyriel
cyriel

Reputation: 3532

As you can see in error message (here: requires version 34.0.0 or later, but libpng16.16.dylib provides version 33.0.0) OpenCV requires libpng in version 34.00 or later (and you have 33.0.0), so you need to install newer version of this lib. If simple brew install libpng will not solve the problem try to uninstall it and than use this solution to install it again.

Upvotes: 1

Related Questions