[Kde-bindings] is it possible to use qtruby4 with ruby 1.9?

Richard Dale rdale at foton.es
Sun Feb 1 17:12:15 UTC 2009


On Sunday 01 February 2009 17:04:11 Stefano Crocco wrote:
> Should it be possible to use qtruby4 with ruby 1.9? I just tried with the
> recently released ruby 1.9.1, but, although everything compiled, when I
> tried to use it, I got an horrible crash.
>
> The procedure I followed to compile qtruby was the following (I'm
> describing it in case I forgot to do something):
>
> cd kdebindings
> mkdir build
> cd build
> cmake ..
> ccmake .
>
> Using ccmake, I changed the CUSTOM_RUBY_SITE_ARCH_DIR variable to
> /usr/local/lib/ruby19/site_ruby/1.9.1/i686-linux
> and the CUSTOM_RUBY_SITE_LIB_DIR variable to
> /usr/local/lib/ruby19/site_ruby/1.9.1
>
> make
> sudo make install
>
> As I said, everything compiled and installed correctly. I then tried the
> following command:
>
> ruby19 -rQt4 -e 'Qt::Point.new 2,3'
>
> This produced a crash and the following output:
>
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2529: [BUG] unknown
> type 0x22 (0xc given)
> ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]
>
> -- control frame ----------
> c:0011 p:---- s:0034 b:0034 l:000033 d:000033 CFUNC  :initialize
> c:0010 p:---- s:0032 b:0032 l:000031 d:000031 CFUNC  :call
> c:0009 p:0014 s:0027 b:0027 l:000018 d:000026 BLOCK
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2529
> c:0008 p:---- s:0025 b:0025 l:000024 d:000024 FINISH
> c:0007 p:---- s:0023 b:0023 l:000022 d:000022 CFUNC  :catch
> c:0006 p:0027 s:0019 b:0019 l:000018 d:000018 METHOD
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2528
> c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
> c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :new
> c:0003 p:0021 s:0006 b:0006 l:000f3c d:00056c EVAL   -e:1
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:000f3c d:000f3c TOP    <main>:25
> ---------------------------
> -- Ruby level backtrace
> information-----------------------------------------
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2529:in `initialize'
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2529:in `call'
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2529:in `block in
> try_initialize'
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2528:in `catch'
> /usr/local/lib/ruby19/site_ruby/1.9.1/Qt/qtruby4.rb:2528:in
> `try_initialize' -e:1:in `new'
> -e:1:in `<main>'
>
> -- C level backtrace information
> ------------------------------------------- 0x812a4a8
> ruby19(rb_vm_bugreport+0x48) [0x812a4a8]
> 0x81584ee ruby19 [0x81584ee]
> 0x8158568 ruby19(rb_bug+0x28) [0x8158568]
> 0x815888a ruby19(rb_check_type+0xca) [0x815888a]
> 0xb7d4afcd /usr/local/lib/ruby19/site_ruby/1.9.1/i686-linux/qtruby4.so
> [0xb7d4afcd]
> 0x8118aed ruby19 [0x8118aed]
> 0x8127a14 ruby19(rb_vm_call+0x2b4) [0x8127a14]
> 0x805fd3f ruby19(rb_method_call+0x16f) [0x805fd3f]
> 0x8118aed ruby19 [0x8118aed]
> 0x81265ce ruby19 [0x81265ce]
> 0x811fd9f ruby19 [0x811fd9f]
> 0x8123a2c ruby19 [0x8123a2c]
> 0x8125048 ruby19 [0x8125048]
> 0x8118aed ruby19 [0x8118aed]
> 0x81265ce ruby19 [0x81265ce]
> 0x811fd9f ruby19 [0x811fd9f]
> 0x8123a2c ruby19 [0x8123a2c]
> 0x811ab95 ruby19 [0x811ab95]
> 0xb7d4ab26 /usr/local/lib/ruby19/site_ruby/1.9.1/i686-linux/qtruby4.so
> [0xb7d4ab26]
> 0x8118aed ruby19 [0x8118aed]
> 0x81265ce ruby19 [0x81265ce]
> 0x811fd9f ruby19 [0x811fd9f]
> 0x8123a2c ruby19 [0x8123a2c]
> 0x8123b84 ruby19(rb_iseq_eval_main+0x94) [0x8123b84]
> 0x805d2cf ruby19(ruby_exec_node+0x9f) [0x805d2cf]
> 0x805e7d6 ruby19(ruby_run_node+0x46) [0x805e7d6]
> 0x805be10 ruby19(main+0x60) [0x805be10]
> 0xb7e53725 /lib/libc.so.6(__libc_start_main+0xe5) [0xb7e53725]
> 0x805bd11 ruby19 [0x805bd11]
>
> Can't qtruby be used with ruby 1.9 or have I missed something in the
> installation procedure?
There is a patch to get QtRuby working with Ruby 1.9.x that was posted on this 
list a couple of months ago. One of the changes was to try_initialize() to 
catch a symbol rather than a string:

		def Internal.try_initialize(instance, *args)
			initializer = instance.method(:initialize)
			catch :newqt do
				initializer.call(*args)
			end
		end

Does that fix it?

-- Richard



More information about the Kde-bindings mailing list