0

I'm trying to use ruby on a Raspberry Pi with the ruby-opencv gem - but alas it will not build :(

root@raspberrypi:/usr/lib# uname -a
Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux   
root@raspberrypi:/usr/lib# ruby -v
ruby 2.1.5p273 (2014-11-13) [arm-linux-gnueabihf]
root@raspberrypi:~# apt-get install libopencv-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libopencv-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
root@raspberrypi:~# apt-get install libopencv-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libopencv-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
root@raspberrypi:~# gem install ruby-opencv
Fetching: ruby-opencv-0.0.18.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-opencv:
        ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
>> Check the required libraries...
checking for main() in -lstdc++... yes
checking for main() in -lopencv_calib3d... yes
checking for main() in -lopencv_contrib... yes
checking for main() in -lopencv_core... yes
checking for main() in -lopencv_features2d... yes
checking for main() in -lopencv_flann... yes
checking for main() in -lopencv_highgui... yes
checking for main() in -lopencv_imgproc... yes
checking for main() in -lopencv_legacy... yes
checking for main() in -lopencv_ml... yes
checking for main() in -lopencv_objdetect... yes
checking for main() in -lopencv_video... yes
checking for main() in -lopencv_photo... yes
checking for main() in -lopencv_gpu... yes
checking for main() in -lopencv_nonfree... no
opencv_nonfree not found.
>> Check the required headers...
checking for opencv2/core/core_c.h... yes
checking for opencv2/core/core.hpp... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby
        --with-opencv-dir
        --without-opencv-dir
        --with-opencv-include
        --without-opencv-include=${opencv-dir}/include
        --with-opencv-lib
        --without-opencv-lib=${opencv-dir}/lib
        --with-libxml2-dir
        --without-libxml2-dir
        --with-libxml2-include
        --without-libxml2-include=${libxml2-dir}/include
        --with-libxml2-lib
        --without-libxml2-lib=${libxml2-dir}/lib
        --with-stdc++lib
        --without-stdc++lib
        --with-opencv_calib3dlib
        --without-opencv_calib3dlib
        --with-opencv_contriblib
        --without-opencv_contriblib
        --with-opencv_corelib
        --without-opencv_corelib
        --with-opencv_features2dlib
        --without-opencv_features2dlib
        --with-opencv_flannlib
        --without-opencv_flannlib
        --with-opencv_highguilib
        --without-opencv_highguilib
        --with-opencv_imgproclib
        --without-opencv_imgproclib
        --with-opencv_legacylib
        --without-opencv_legacylib
        --with-opencv_mllib
        --without-opencv_mllib
        --with-opencv_objdetectlib
        --without-opencv_objdetectlib
        --with-opencv_videolib
        --without-opencv_videolib
        --with-opencv_photolib
        --without-opencv_photolib
        --with-opencv_gpulib
        --without-opencv_gpulib
        --with-opencv_nonfreelib
        --without-opencv_nonfreelib
extconf.rb:63:in `block in <main>': opencv2/core/core.hpp not found. (RuntimeError)
        from extconf.rb:63:in `each'
        from extconf.rb:63:in `<main>'


Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/ruby-opencv-0.0.18 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/ruby-opencv-0.0.18/ext/opencv/gem_make.out
root@raspberrypi:~#    
-2

I found this tutorial: https://blog.cedric.ws/install-opencv-on-raspberry-pi

hope it helps :)

  • 2
    Hello and welcome! Please take the tour and visit the helpcenter. Whilst this may theoretically answer the question, it is preferable to include the essential parts of the answer here, and provide the link for reference. In fact we're enforcing this policy: please edit so that the answer stands on its own should the link break in the future. If it is not edited within 48 hours it will be converted to Community Wiki. – Ghanima May 6 '17 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.