Ruby, Qt4-Bindings, and Gentoo

As I wrote in the About-section, I was waiting for a chance to increase my experience with ruby. And I got one! However, the “chance” itself is not of importance in this post

Fact is, the decision had to be made, which GUI-framework I want to use in the future. Since I’m a KDE user and KDE’s used framework is Qt4 and since I nearly heard only good things of it (not to mention, it’s open source now), I choose to use it: Qt4. The next logical step was, of course, to look for bindings for Ruby and install them. Sounds easy, but it barely was.

After a unsuccessfull look into the Gentoo portage-tree, I tried my luck in the web. And here (a RubyForge project) it is. Okay, at least there exists a stable version, but building it myself is the last thing I wanna do. I gave RubyGem a try. It’s the Ruby’s package manager, which is delivered with Ruby. I found the right package in the repository, but it was only a win32-version, so it’s not of use for me. At next, Google told me about a qt4-qtruby-ebuild in the qting-edge portage-overlay. Adding the overlay and emerging the ebuild brought me following:

Scanning dependencies of target smokeqt
[ 32%] [ 34%] Building CXX object smoke/qt/CMakeFiles/smokeqt.dir/smokedata.o
[ 36%] Building CXX object smoke/qt/CMakeFiles/smokeqt.dir/x_1.o
Building CXX object smoke/qt/CMakeFiles/smokeqt.dir/x_2.o
/dev/shm/portage/dev-ruby/qt4-qtruby-2.0.3/work/qt4-qtruby-2.0.3_build/smoke/qt/smokedata.cpp:6086:
error: expected ‘}’ before ‘com’
/dev/shm/portage/dev-ruby/qt4-qtruby-2.0.3/work/qt4-qtruby-2.0.3_build/smoke/qt/smokedata.cpp:6086:
error: expected ‘}’ before ‘com’
/dev/shm/portage/dev-ruby/qt4-qtruby-2.0.3/work/qt4-qtruby-2.0.3_build/smoke/qt/smokedata.cpp:6086:
error: expected ‘,’ or ‘;’ before ‘com’
/dev/shm/portage/dev-ruby/qt4-qtruby-2.0.3/work/qt4-qtruby-2.0.3_build/smoke/qt/smokedata.cpp:6086:
error: expected declaration before ‘}’ token
make[2]: *** [smoke/qt/CMakeFiles/smokeqt.dir/smokedata.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [smoke/qt/CMakeFiles/smokeqt.dir/all] Error 2
make: *** [all] Error 2

Disappointment after disappointment …

After some time searching the web for answers, I finally found a appropriate bugreport. It told me to make use of the kdebindings-ruby-ebuild from the kde-overlay (never saw it before). I emerged it, and violá: after spending a day searching the one word kdebindings-ruby, the bindings were finally installed.

I even managed to get my first Hello World-program running:

require 'Qt'

app = Qt::Application.new ARGV

hello = Qt::PushButton.new "Hello World!"
hello.resize(100,30)
hello.show

app.exec

Hello World!

By the way this is my first blog-entry, so this program seems to be quite suitable. ;-)

Follow

Get every new post delivered to your Inbox.