I am running KDE on 32-bit Linux Mint Debian Edition. For several years
now I
have been developing Qt-based applications with Ruby 1.8.
Now I’m anxious to move forward and adopt Ruby 1.9 as urged. I can
install
1.9.2 from the LMDE repositories, but there doesn’t appear to be any Qt4
libraries available. So I thought I’d go right up to date, downloading
and
compiling Ruby 1.9.3p0 from scratch, installing it in the /usr/local
hierarchy.
I found, downloaded and extracted the latest Qt4-QtRuby build files.
This is
where the headaches began. Running cmake . failed immediately as cmake
could
not find Ruby. After scratching my head and searching Google I
established
that the CMakeCache.txt file needed some tweaking. To be precise, these
lines
needed to be filled out to allow cmake to find the ruby.h file and ruby
executable:
//Path to a file.
RUBY_CONFIG_INCLUDE_DIR:PATH=/usr/local/include/ruby-1.9.1/i686-linux
//Path to a program.
RUBY_EXECUTABLE:FILEPATH=/usr/local/bin/ruby
This, then, allowed me to build and install the Qt4-QtRuby library. But
then,
when I went to test it with a very minimal script:
#!/usr/local/bin/ruby -w
require ‘Qt4’
app = Qt::Application.new(ARGV)
app.exec()
I get the response:
/usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:1415: warning:
mismatched
indentations at ‘end’ with ‘if’ at 1411
/usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method
redefined; discarding old method_missing
[…]
/usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method
redefined; discarding old const_missing
/usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:459:in initialize': unresolved constructor call Qt::Application (ArgumentError) from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:459:in
initialize’
from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2640:in
call' from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2640:in
block
in try_initialize’
from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2639:in
catch' from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2639:in
try_initialize’
from ./qt.rb:16:in new' from ./qt.rb:16:in
’
(that second warning repeated several hundred times, though I’m not all
that
concerned about that.)
The test script works fine under 1.8.7, obviously it doesn’t do anything
but it
doesn’t throw any warnings or errors either.
Doing the same in irb yields
irb(main):001:0> require ‘Qt4’
=> true
irb(main):002:0> app = Qt::Application.new(ARGV)
ArgumentError: unresolved constructor call Qt::Application
from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:459:in
initialize' from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:459:in
initialize’
from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2640:in
call' from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2640:in
block
in try_initialize’
from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2639:in
catch' from /usr/local/lib/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2639:in
try_initialize’
from (irb):2:in new' from (irb):2 from /usr/local/bin/irb:12:in
’
irb(main):003:0>
Enquiries on Google haven’t been very fruitful, with just a suggestion
that
the fault lies in the Qt.cpp file but not much help that I could see on
exactly
what the problem is or how to fix it (my knowledge of C++ is sketchy at
best).
I have the feeling either that I’ve missed something very simple, or
that Ruby
1.9.x is not yet able to work effectively with Qt4. Is there anybody
here who
has encountered this problem? Should I carry on regardless with 1.9.3
and find
another GUI interface to work with, or should I reluctantly revert to
1.8.7?
Rosie