I'm trying to run wxRuby with Ruby 1.9, but I can't start up the application without getting a segfault. Even the small minimal application suggested on the website (code used is below) won't run.
require "wx"
include Wx
class MinimalApp < App
def on_init
Frame.new(nil, -1, "Test").show
end
end
MinimalApp.new.main_loop
The program, when ran with ruby test.rb
, crashes with the following message:
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :main_loop
c:0003 p:0066 s:0006 b:0006 l:001078 d:0007a8 EVAL test.rb:10
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001078 d:001078 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
test.rb:10:in `<main>'
test.rb:10:in `main_loop'
-- C level backtrace information -------------------------------------------
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(rb_vm_bugreport+0x5e) [0x7f8ae7464b9e]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x64234) [0x7f8ae7340234]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(rb_bug+0xa5) [0x7f8ae73410c5]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x118c04) [0x7f8ae73f4c04]
/lib64/libpthread.so.0() [0x3b6e80efe0]
/lib64/libwx_baseu-2.8.so.0(_ZN7wxMutex6UnlockEv+0) [0x3b790e4390]
/lib64/libwx_gtk2u_core-2.8.so.0() [0x3b7a9e452b]
/lib64/libglib-2.0.so.0() [0x3b70047964]
/lib64/libglib-2.0.so.0(g_main_loop_run+0x72) [0x3b70047dc2]
/lib64/libgtk-x11-2.0.so.0(gtk_main+0xa7) [0x3b7b54ac57]
/lib64/libwx_gtk2u_core-2.8.so.0(_ZN11wxEventLoop3RunEv+0x48) [0x3b7a9f81d8]
/lib64/libwx_gtk2u_core-2.8.so.0(_ZN9wxAppBase8MainLoopEv+0x4c) [0x3b7aa6a30c]
/lib64/libwx_gtk2u_core-2.8.so.0(_ZN5wxApp10InitializeERiPPw+0x371) [0x3b7a9e4a41]
/lib64/libwx_baseu-2.8.so.0(_Z12wxEntryStartRiPPw+0x7e) [0x3b7909745e]
/lib64/libwx_baseu-2.8.so.0(_Z12wxInitializeiPPw+0x3c) [0x3b7909776c]
/lib64/libwx_baseu-2.8.so.0(_Z7wxEntryRiPPw+0x1a) [0x3b7909788a]
/home/vinny/.rvm/gems/ruby-1.9.2-p320/gems/wxruby-ruby19-2.0.0-x86_64-linux/lib/wxruby2.so(+0x21b403) [0x7f8ae00cb403]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x181d8c) [0x7f8ae745dd8c]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x17a142) [0x7f8ae7456142]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x17e430) [0x7f8ae745a430]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(rb_iseq_eval_main+0xb0) [0x7f8ae7460330]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x6a59a) [0x7f8ae734659a]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(ruby_exec_node+0x1d) [0x7f8ae73475bd]
/home/vinny/.rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(ruby_run_node+0x1c) [0x7f8ae734954c]
ruby(main+0x4b) [0x40088b]
/lib64/libc.so.6(__libc_start_main+0xf5) [0x3b6e421735]
ruby() [0x4008b9]
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
Aborted (core dumped)
I have tried this on both Ruby 1.9.3p194 and 1.9.2p320 (the log for the latter shown above), both with the same result. I haven't tested on Ruby 1.8, but I'd rather not have to use 1.8 in order to run wxRuby.
My Ruby versions are managed with RVM and the wxRuby version installed is 2.0.0 (gem name- wxruby-ruby19) (2.0.1 isn't available for 64-bit Linux).
I have verified in irb that "wx" can be required successfully, but as soon as the main_loop method is run, it crashes.
My operating system is Fedora 17 x64, and I have the wxGTK 2.8.12 package installed for use with C++, if that makes a difference.