stuck on opencv gem
recap: trying to install opencv gem, it's not installing.
kudi-guetta% gem install opencv
Building native extensions. This could take a while...
ERROR: Error installing opencv:
ERROR: Failed to build gem native extension.
/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/bin/ruby extconf.rb
>> check require libraries...
checking for main() in -lcxcore... yes
checking for main() in -lcv... yes
checking for main() in -lhighgui... yes
checking for main() in -lstdc++... yes
>> check require headers...
checking for cxcore.h... 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=/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/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-ffcall-dir
--without-ffcall-dir
--with-ffcall-include
--without-ffcall-include=${ffcall-dir}/include
--with-ffcall-lib
--without-ffcall-lib=${ffcall-dir}/lib
--with-cxcorelib
--without-cxcorelib
--with-cvlib
--without-cvlib
--with-highguilib
--without-highguilib
--with-stdc++lib
--without-stdc++lib
extconf.rb:41: cxcore.h not found. (RuntimeError)
from extconf.rb:40:in `each'
from extconf.rb:40
Gem files will remain installed in /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/opencv-0.0.7 for inspection.
Results logged to /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/opencv-0.0.7/ext/gem_make.out
annoying.
jim v on rubyforge seems to have solved the problem. except where do i run
ruby extconf.rb? i went to the directory containing
gem_make.out to read it. turns out it just has the same thing as was printed to terminal above. but in the same directory was
extconf.rb.
extconf.rb
i planned on running
ruby extconf.rb with some extra flags, like jim v. for the values to the flag:
kudi-guetta% find / -name cxcore.h 2> /dev/null
/usr/include/opencv/cxcore.h
that's the header file location. i also needed the lib file location.
kudi-guetta% ls /usr/lib|grep opencv
kudi-guetta% find / -name "*opencv*" 2> /dev/null
...
/usr/lib/pkgconfig/opencv.pc
...
i vaguely remember *.pc files from some other project. they are used by pkg-config to get the location of libs and header files. so i checked in there for the locations.
popped open
extconf.rb just to see what was in it.
made these changes to it:
then in that directory:
rvm 1.8.7@hornetseye
ruby extconf.rb
make
still a fail, but in a different place:
kudi-guetta% ruby extconf.rb
>> check require libraries...
checking for main() in -lcxcore... yes
checking for main() in -lcv... yes
checking for main() in -lhighgui... yes
checking for main() in -lstdc++... yes
>> check require headers...
checking for cxcore.h... yes
checking for cv.h... yes
checking for highgui.h... yes
checking for stdarg.h... yes
>> ----- optional -----
>> check ffcall...
checking for main() in -lcallback... yes
checking for callback.h... yes
>> support OpenCV::GUI
creating Makefile
kudi-guetta% make
g++ -I. -I. -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -I. -DHAVE_CXCORE_H -DHAVE_CV_H -DHAVE_HIGHGUI_H -DHAVE_STDARG_H -DHAVE_CALLBACK_H -I/usr/include -I/usr/include/opencv -fPIC -g -O2 -fPIC -c cvchaincode.cpp
In file included from opencv.h:106,
from cvchaincode.h:13,
from cvchaincode.cpp:10:
cvcondensation.h:39: error: expected initializer before ‘*’ token
cvchaincode.cpp:49: error: expected ‘}’ at end of input
make: *** [cvchaincode.o] Error 1
aaaRRRGGG
wedekind's opencv ruby gem
ugh.
going back to the install site, i see this:
If you are unable to use RubyGems to install opencv, you may have to install hornetseye-opencv from source:
git clone git://github.com/wedesoft/hornetseye-opencv.git
cd hornetseye-opencv
rake
sudo rake install
cd ..
which isn't working for me. or ... it doesn't seem to be. here's what i get:
kudi-guetta% pwd
/home/ozzloy/src/hornetseye/hornetseye-opencv
kudi-guetta% rake
(in /home/ozzloy/src/hornetseye/hornetseye-opencv)
kudi-guetta% rake install
(in /home/ozzloy/src/hornetseye/hornetseye-opencv)
kudi-guetta% rake test
(in /home/ozzloy/src/hornetseye/hornetseye-opencv)
ext/hornetseye_opencv.so: no such file to load -- opencv (LoadError)
from ./test/tc_hornetseye_opencv.rb:22
from /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/b...]
(See full trace by running task with --trace)
just under the instructions for installing hornetseye-opencv, the page links to
wedekind's fork of the opencv gem which i tried installing next.
installing wedekind's opencv gem fork
here's the tail end of the install process from
wedekind's opencv gem install instructions.
kudi-guetta% rake gem
(in /home/ozzloy/src/hornetseye/ruby-opencv)
mkdir -p pkg
Gemspec generated
WARNING: description and summary are identical
Successfully built RubyGem
Name: opencv
Version: 0.0.7
File: opencv-0.0.7.gem
mv opencv-0.0.7.gem pkg/opencv-0.0.7.gem
kudi-guetta% gem install pkg/opencv-0.0.7.gem
Building native extensions. This could take a while...
ERROR: Error installing pkg/opencv-0.0.7.gem:
ERROR: Failed to build gem native extension.
/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/bin/ruby extconf.rb
>> check require libraries...
checking for main() in -lcxcore... yes
checking for main() in -lcv... yes
checking for main() in -lhighgui... yes
checking for main() in -lcvaux... yes
checking for main() in -lstdc++... yes
>> check require headers...
checking for cxcore.h... yes
checking for cv.h... yes
checking for highgui.h... yes
checking for cvaux.h... yes
checking for stdarg.h... yes
>> ----- optional -----
>> check ffcall...
checking for main() in -lcallback... yes
checking for callback.h... yes
>> support OpenCV::GUI
creating Makefile
make
g++ -I. -I. -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -I. -DHAVE_CXCORE_H -DHAVE_CV_H -DHAVE_HIGHGUI_H -DHAVE_CVAUX_H -DHAVE_STDARG_H -DHAVE_CALLBACK_H -I/usr/include -I/usr/include/opencv -fPIC -g -O2 -fPIC -c cvchaincode.cpp
In file included from opencv.h:101,
from cvchaincode.h:13,
from cvchaincode.cpp:10:
cvcondensation.h:39: error: expected initializer before ‘*’ token
cvchaincode.cpp:49: error: expected ‘}’ at end of input
make: *** [cvchaincode.o] Error 1
Gem files will remain installed in /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/opencv-0.0.7 for inspection.
Results logged to /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/opencv-0.0.7/ext/gem_make.out
and this is the same problem i was having installing the gem via
gem install opencv, after modifying the extconf.rb file to point to the right places. what do i do now? i'll see if i can figure out the problem with cvcondensation.h. nope, the file looks fine at line 39.
moving on to openexr
this installed just fine with:
sudo aptitude install -y libopenexr-dev
gem install hornetseye-openexr #i'm using rvm
on to qt4
installing the qt libs and stuff went fine
sudo aptitude install libqt4-ruby1.8 qt4-dev-tools libswscale-dev -y
but the next step didn't work:
kudi-guetta% cd hornetseye-qt4
kudi-guetta% rake
(in /home/ozzloy/src/hornetseye/hornetseye-qt4)
g++ -MM ext/xvwidget.cc ext/frame.cc ext/init.cc | sed -e :a -e N -e 's/\n/\$/g' -e ta | sed -e 's/ *\\\$ */ /g' -e 's/\$/\n/g' | sed -e 's/^/ext\//' > .depends.mf
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/usr/include/qt4 -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/xvwidget.o ext/xvwidget.cc
In file included from ext/xvwidget.cc:36:
ext/xvwidget.hh:22: fatal error: X11/extensions/Xv.h: No such file or directory
compilation terminated.
rake aborted!
Command failed with status (1): [g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONS...]
/home/ozzloy/src/hornetseye/hornetseye-qt4/Rakefile:210
(See full trace by running task with --trace)
kudi-guetta%
i'll come back to this too.
so far i fail at ruby-opencv and hornetseye-qt4.
hornetseye-rmagick
of course the ubuntu stuff works fine:
sudo aptitude install libmagickwand-dev -y.
woo! this seems to have worked as well:
gem install hornetseye-rmagick (again, using rvm)
skipping v4l, straight to v4l2
sudo aptitude install linux-libc-dev -y was already installed.
gem install hornetseye-v4l2 went just fine too.
hornetseye-xorg
this might solve the problem with qt4 since it had something to do with a missing header file in some X11 path. let's hope so.
sudo aptitude install xserver-xorg-dev libgl1-mesa-dev libglu1-mesa-dev -y worked
gem install hornetseye-xorg failed like this:
kudi-guetta% gem install hornetseye-xorg
Fetching: hornetseye-xorg-0.5.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing hornetseye-xorg:
ERROR: Failed to build gem native extension.
"/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/bin/ruby" -rubygems /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@global/gems/rake-0.8.7/bin/rake RUBYARCHDIR=/home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/lib RUBYLIBDIR=/home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/lib
g++ -MM ext/openglimagepainter.cc ext/x11window.cc ext/x11output.cc ext/xvideoimagepainter.cc ext/frame.cc ext/x11display.cc ext/init.cc ext/timer.cc ext/ximagepainter.cc | sed -e :a -e N -e 's/\n/\$/g' -e ta | sed -e 's/ *\\\$ */ /g' -e 's/\$/\n/g' | sed -e 's/^/ext\//' > .depends.mf
(in /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2)
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/openglimagepainter.o ext/openglimagepainter.cc
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/x11window.o ext/x11window.cc
ext/x11window.cc:20: fatal error: X11/xpm.h: No such file or directory
compilation terminated.
rake aborted!
Command failed with status (1): [g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONS...]
/home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/Rakefile:209
(See full trace by running task with --trace)
Gem files will remain installed in /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2 for inspection.
Results logged to /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/./gem_make.out
damn. since that's the last section of interest to me, i'll try to solve it.
google for "X11/xpm.h: No such file or directory" gives me
yinglcs2's similar problem. solution:
sudo aptitude install -y libxpm-dev.
now it fails with a different message:
kudi-guetta% gem install hornetseye-xorg
Building native extensions. This could take a while...
ERROR: Error installing hornetseye-xorg:
ERROR: Failed to build gem native extension.
"/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/bin/ruby" -rubygems /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@global/gems/rake-0.8.7/bin/rake RUBYARCHDIR=/home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/lib RUBYLIBDIR=/home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/lib
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/openglimagepainter.o ext/openglimagepainter.cc
(in /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2)
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/x11window.o ext/x11window.cc
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/x11output.o ext/x11output.cc
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/xvideoimagepainter.o ext/xvideoimagepainter.cc
In file included from ext/xvideoimagepainter.cc:35:
ext/xvideoimagepainter.hh:20: fatal error: X11/extensions/Xvlib.h: No such file or directory
compilation terminated.
rake aborted!
Command failed with status (1): [g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONS...]
/home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/Rakefile:209
(See full trace by running task with --trace)
Gem files will remain installed in /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2 for inspection.
Results logged to /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/hornetseye-xorg-0.5.2/./gem_make.out
so to google again, this time for "X11/extensions/Xvlib.h: No such file or directory".
found a solution from
ubuntu forum's abhayashi:
sudo aptitude install -y libxv-dev
and now
gem install hornetseye-xorg works!
back to hornetseye-qt4
since hornetseye-xorg involved a bunch of x stuff, and the qt4 error looked like a missing x header, i'll just try installing it again:
kudi-guetta% pwd
/home/ozzloy/src/hornetseye/hornetseye-qt4
kudi-guetta% rake
(in /home/ozzloy/src/hornetseye/hornetseye-qt4)
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/usr/include/qt4 -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/xvwidget.o ext/xvwidget.cc
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/usr/include/qt4 -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/frame.o ext/frame.cc
g++ -DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS -g -O2 -fPIC -I/usr/include/qt4 -I/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/x86_64-linux -c -o ext/init.o ext/init.cc
g++ -shared -o ext/hornetseye_qt4.so ext/xvwidget.o ext/frame.o ext/init.o -lswscale -lX11 -lXv -lQtGui -lQtCore -L/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib -Wl,-R -Wl,/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib -L/home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib -lruby -L. -rdynamic -Wl,-export-dynamic -lrt -ldl -lcrypt -lm -lc
kudi-guetta% rake install
(in /home/ozzloy/src/hornetseye/hornetseye-qt4)
kudi-guetta% rake test
(in /home/ozzloy/src/hornetseye/hornetseye-qt4)
hooray! that looks like it worked. now the only problem is with the opencv extension.