Wednesday, March 23, 2011

hornetseye install continued

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.

Monday, March 21, 2011

hornets eye install

http://www.wedesoft.demon.co.uk/hornetseye-api/file.Installation.html
sudo aptitude install build-essential ruby1.8 ruby1.8-dev irb1.8 rubygems1.8 rake libswscale-dev

first problem


googled "sh: rake1.8: not found" and got a solution. it even has a little explanation of what's wrong and suggested short, medium, and long term workarounds.
sudo su -
rake=/usr/bin/rake gem install malloc

another workaround

i initially didn't encounter this problem because i had started off using rvm and creating a gemset for hornetseye. then i thought i should follow the instructions on the site more closely to avoid headaches. so that's funny. rvm sets up the paths and stuff correctly i guess, so the rvm install of 1.8.7 has no problem finding the rvm install of rake.

second problem

same as the first one, but with multiarray in place of malloc. again, not a problem when i was using rvm.

screw it, using rvm

i'll keep using rvm until i run across some problem forcing me to do it without rvm.

hornetseye-frame problem

installing hornets-frame complains too:

looks like it needs some boost lib. off to google again. also i tried installing the yard gem, but that gave some error output, so i abandoned it... but turns out the solution presents itself in the next step anyways. gem install yard
googled for "fatal error: boost/smart_ptr.hpp: No such file or directory" and got this (among others). need to sudo aptitude install -y libboost-dev

yet another hornetseye-frame problem

this time, hornetseye-frame installed, but its documentation seems to have failed.

but it looks like the solution is right there in the error output, so i'll try installing bluecloth like it says: gem install bluecloth. after this, i retried installing yard, in case there was stuff it failed to do on the failed install attempt in the last step. gem install yard

tangent on yard gem

so yard sure did have a ton of other stuff to do.
gem install yard gave a ton of output like this:
[error]: Exception occurred while generating 'YARD/Server/Commands/ListMethodsCo
mmand.html'  
[error]: ArgumentError: wrong number of arguments (1 for 0)
[error]: Stack trace:
        /home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `raise'
        /home/ozzloy/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `require'
        /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/yard-0.6.5/lib/yard/templates/helpers/html_helper.rb:456:in `simple_markup_html'
        /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/yard-0.6.5/lib/yard/templates/helpers/html_helper.rb:81:in `html_markup_rdoc'
        /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/yard-0.6.5/lib/yard/templates/helpers/html_helper.rb:42:in `send'
        /home/ozzloy/.rvm/gems/ruby-1.8.7-p330@hornetseye/gems/yard-0.6.5/lib/yard/templates/helpers/html_helper.rb:42:in `htmlify'
to google again, searching for
[error]: Exception occurred while generating 'YARD/Server/Commands/ListMethodsCo
mmand.html'
which yielded nothing. this time i searched for "ubuntu yard gem" and got jenny fong's blog entry dealing with yard on ubuntu. from there i gathered i needed to start fresh with rdoc and yard, which i did like this:
sudo gem uninstall rdoc # complained that rdoc wasn't installed
gem uninstall rdoc # also complained that rdoc wasn't installed
gem install rdoc # took a while, but worked
gem install yard

thankfully, that worked.

yard gem tangent done

retrying the hornetseye-frame install: gem install hornetseye-frame
it worked! on to the next line.

hornetseye-{alsa,1394}

this worked just fine:
sudo aptitude install -y libasound2-dev
gem install hornetseye-alsa
sudo aptitude install -y libdc1394-22-dev
gem install hornetseye-1394
sudo aptitude install -y libavformat-dev libswscale-dev
gem install hornetseye-ffmpeg
gem install hornetseye-narray
gem install narray

opencv problem

tried gem install opencv which gave this output:

i have dealt with opencv before, so i knew there was something with a name like "libcv" that i probably needed. aptitude search libcv turned up what i was looking for. next this:
sudo aptitude install -y libcv-dev libcv2.1 libcvaux-dev libcvaux2.1

still no opencv gem

another try at gem install opencv gave this:

needs some highgui dev package i think. google search for the fail line yielded nothing, but i had more luck with aptitude search highgui|grep dev. this gave the package name which i installed via sudo aptitude install -y libhighgui-dev

still still no opencv gem

even after installing that stuff i get the following behavior

so i'm gonna go to sleep now and try to finish tomorrow. i'll probably just have to give a flag of what directory to include for opencv junk. (the bulk of this post was written a day before i posted it.)

Where am I?