Segmentation Fault

Hi there,

I am relative new to the wxRuby so please bear with me.

I use Ubuntu Hardy Heron 8.04 release. I have installed the wxwidgets C
libraries
and then did a

gem install wxruby

The ruby extensions were downloaded and installed correctly. If i do

$gem list --local

wxruby (1.9.7)

Then I tried to run a simple example “Hello World” as described in the
tutorial

http://wxruby.rubyforge.org/wiki/wiki.pl?Hello_World

The frame is displayed correctly, but when i close the window i get:

$ruby testwxruby.rb
testwxruby.rb:10: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

Aborted

I tried to run another example mainly
http://wxruby.rubyforge.org/wiki/wiki.pl?Using_Dialogs_To_Talk_To_Users

Although the apps starts and works ok, when i close it i get the same
message “Segmentation Fault”

Is this a known issue?

(The wxwidgets library installed in the system as seen by synaptic is
2.8.7.1-0-ubuntu3)

and
$ gem --version
1.1.1

(The rubygem was installed manually and not using the default that
ubuntu comes which is 0.9.4-4)

Thanks in advace,
Christos

i forgot to mention the version of ruby

$ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]

This is the default that Ubuntu Hardy comes with.

Christos

Christos Vasilakis wrote:

Hi there,

I am relative new to the wxRuby so please bear with me.

I use Ubuntu Hardy Heron 8.04 release. I have installed the wxwidgets C
libraries
and then did a

gem install wxruby

The ruby extensions were downloaded and installed correctly. If i do

$gem list --local

wxruby (1.9.7)

Then I tried to run a simple example “Hello World” as described in the
tutorial

http://wxruby.rubyforge.org/wiki/wiki.pl?Hello_World

The frame is displayed correctly, but when i close the window i get:

$ruby testwxruby.rb
testwxruby.rb:10: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

Aborted

I tried to run another example mainly
http://wxruby.rubyforge.org/wiki/wiki.pl?Using_Dialogs_To_Talk_To_Users

Although the apps starts and works ok, when i close it i get the same
message “Segmentation Fault”

Is this a known issue?

(The wxwidgets library installed in the system as seen by synaptic is
2.8.7.1-0-ubuntu3)

and
$ gem --version
1.1.1

(The rubygem was installed manually and not using the default that
ubuntu comes which is 0.9.4-4)

Thanks in advace,
Christos

I get this as well with every wxruby program I run. I wrote an
email/topic about it a month or so back. I have a feeling it is to do
with the ruby patchlevel 111. Right now I’mjust living with it and
hoping it gets fixed.
Woe is me. :frowning:

Lucas

Christos Vasilakis wrote:

http://wxruby.rubyforge.org/wiki/wiki.pl?Hello_World

The frame is displayed correctly, but when i close the window i get:

$ruby testwxruby.rb
testwxruby.rb:10: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

Thanks for the report, and apologies for the delay in replying. I’ve
just fixed a bug which could cause crashes on Linux (and possibly
Windows) in 1.9.7 when Frames with MenuBars were closed. It could cause
problems either on app exit or, if other frames remained open, when
garbage collection ran.

Hopefully this will address instabilities reported by several users - if
anyone has the development set up on Linux and can test this with SVN
head, it would be much appreciated.

Sorry for the trouble
alex

Hi Alex and thank you for your replay.

All tests run on a clean ubuntu install with no previous wxruby
instances(I had to reformat my hard drive some days ago)

Here is what I did:

I download the svn version of wxruby as described in the wiki:

http://wxruby.rubyforge.org/wiki/wiki.pl?InstallingFromSource

cvasilak@casper:~$ svn co
svn://rubyforge.org/var/svn/wxruby/trunk/wxruby2


Checked out revision 1751.

cvasilak@casper:~$ sudo rake

cvasilak@casper:~$ sudo rake gem WXRUBY_VERSION=1.9.7 (just to make it
work, I didn’t know what to supply as the wiki unfortunately doesn’t
specify what, ignore the version tag for now)

cvasilak@casper:~$ sudo gem install wxruby-1.9.7-x86-linux.gem

<installed succesfully in
/usr/lib/ruby/gems/1.8/gems/wxruby-1.9.7-x86-linux/>

Tried to run the hello world found here:

http://wxruby.rubyforge.org/wiki/wiki.pl?Hello_World

cvasilak@casper:/home/cvasilak# ruby helloworld.rb
helloworld.rb:4: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

Aborted

The window doesn’t even pop up I immediately get a segmentation fault.

I tried to run the other example mainly
http://wxruby.rubyforge.org/wiki/wiki.pl?Using_Dialogs_To_Talk_To_Users

Although it runs fine when I close the window I get

cvasilak@casper:/home/cvasilak# ruby okcancel.rb
okcancel.rb:36: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

Aborted

I tried to run the minimal example found in the samples directory of the
wxruby but I get the same segmentation fault when I exit.

Some details:

cvasilak@casper:/home/cvasilak# ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]

cvasilak@casper:/home/cvasilak# gem -v
1.2.0

libwxbase2.8-0 2.8.7.1-0ubuntu-3 (default by repository)
libwxgtk2.8-0 2.8.7.1-0ubuntu-3 (default by repository)

Let me know of any tests you want me to run.

Regards,
Christos

Hi Christos

Thanks for trying this out.

Christos Vasilakis wrote:

svn://rubyforge.org/var/svn/wxruby/trunk/wxruby2
cvasilak@casper:~$ sudo gem install wxruby-1.9.7-x86-linux.gem

Here, instead of trying to install the code you built as a gem, run it
locally from the directory you built wxruby2 in like this:

ruby -Ilib path/to/helloworld.rb

This will ensure that you’re getting the newly-built SVN HEAD version. I
tried running the tests again on a very similar setup (Ubuntu 8.04,
built against the 2.8.7 version wx packages) and both run fine for me
and exit cleanly.

I think what may be happening is that running with rubygems, you’re
getting the original 1.9.7 with the bugs you first reported.

cheers
alex

Christos Vasilakis wrote:

Then I tried to:

root@casper:/home/cvasilak/wxruby/wxruby2# ruby
/home/cvasilak/helloworld.rb
/home/cvasilak/helloworld.rb:1:in `require’: no such file to load – wx
(LoadError)
from /home/cvasilak/helloworld.rb:1

OK, this looks good

receive the segmentation fault.

That’s really weird because as you say I use the same configuration as
yours(Ubuntu 8.04, 2.8.7 wxwidgets etc).
I think the only difference is that I’m using a debug build package of
wxWidgets from Debian (it has the suffix -dbg) rather than the standard
libwx2.8. But that really shouldn’t affect this.

I’d suggest you try doing updating the sources to ensure you’re up to
HEAD (svn up) then doing a clean rebuild (rake reswig; rake). Then try
running it using the local library (ruby -Ilib …)

If you’re still getting the crash, it would be most useful to get a
backtrace from gdb debugger.

Try doing:
gdb --args ruby -Ilib helloworld.rb

Then at the gdb prompt:

gdb> r < ENTER>

If it stops after complaining about threads not found:

gdb> c

Then wait until it crashes. gdb should throw out some info. To get a
full backtrace, do

gdb> whe

This should give a backtrace of where the crash occurred.

thanks for your patience
alex

Hi Alex,

Using your recommentation I tried the following:

First I have unistalled the wx-ruby gem

root@casper:/home/cvasilak/wxruby/wxruby2# gem uninstall wxruby
Successfully uninstalled wxruby-1.9.7-x86-linux

<<Take notice that is a fake version number I have previously installed
from the svn trunk, I just used the same version number of the release
to keep the “rake gem” happy. This is not the official release and no
previous instances of the wxruby is installed in the system.>>

Then I tried to:

root@casper:/home/cvasilak/wxruby/wxruby2# ruby
/home/cvasilak/helloworld.rb
/home/cvasilak/helloworld.rb:1:in `require’: no such file to load – wx
(LoadError)
from /home/cvasilak/helloworld.rb:1

Which is OK since the wxruby library is not installed in the system.

Then I tried to:

root@casper:/home/cvasilak/wxruby/wxruby2# ruby -I lib/
/home/cvasilak/helloworld.rb
/home/cvasilak/helloworld.rb:4: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

Aborted

I tried the second example but this time I get a window but upon exit I
receive the segmentation fault.

That’s really weird because as you say I use the same configuration as
yours(Ubuntu 8.04, 2.8.7 wxwidgets etc). I don’t know if it helps but
the only thing that I manually installed as far as ruby is concerned is
the rubygem ver 1.2.0 because the rubygem package that comes with ubuntu
is quite old(0.9.4)

Here is a list of gems installed in the system

root@casper:/home/cvasilak/wxruby/wxruby2# gem list --local

*** LOCAL GEMS ***

hoe (1.7.0) (dependencies)
rake (0.8.1) (dependencies)
ruby-pg (0.7.9.2008.01.28) (for postgresql access)
rubyforge (1.0.0) (dependencies)
RubyRRDtool (0.6.0) (for statistics using RRD technology)

Let me know if you need more information.

Christos

PS Tomorrow is a public holiday here in Greece and I would be out of
office and home (I will be in my father’s village with no net access) so
If I don’t answer you immediately, bear with me, I would be back on
Saturday.

Hi Alex,

sorry for taking a bit longer to replay, other things kept me busy
during the weekend and I didn’t have time to sit in the computer.

Anyway, here is the list of things I did.

I downloaded the svn version of wxwidgets

root@casper:/home/cvasilak/wxruby-svn# svn co
svn://rubyforge.org/var/svn/wxruby/trunk/wxruby2

Checked out revision 1758.

Tried to run a program:
root@casper:/home/cvasilak/wxruby-svn# ruby /home/cvasilak/helloworld.rb
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- wx (LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from /home/cvasilak/helloworld.rb:1

It’s OK since the wx binding is not installed yet in the system.

Tried to launch with the -I lib argument

root@casper:/home/cvasilak/wxruby-svn/wxruby2# ruby -I lib/
/home/cvasilak/helloworld.rb
/home/cvasilak/helloworld.rb:4: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i486-linux]

Aborted

I get the segmentation fault. Then I tried running it with gdb as you
suggested:

gdb --args ruby -I lib /home/cvasilak/helloworld.rb


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7d29b60 (LWP 9022)]
0xb5f6bf74 in ?? () from /lib/libselinux.so.1
(gdb) whe
#0 0xb5f6bf74 in ?? () from /lib/libselinux.so.1
#1 0xb5f6564e in ?? () from /lib/libselinux.so.1
#2 0xb5f5e100 in ?? () from /lib/libselinux.so.1
#3 0xb5f6d7bc in _fini () from /lib/libselinux.so.1
#4 0xb7fe0fdf in ?? () from /lib/ld-linux.so.2
#5 0xb7d58084 in exit () from /lib/tls/i686/cmov/libc.so.6
#6 0xb7f1ec85 in ruby_stop () from /usr/lib/libruby1.8.so.1.8
#7 0xb7f29cf1 in ruby_run () from /usr/lib/libruby1.8.so.1.8
#8 0x080486bd in main ()
(gdb)

I tried the other example that popups a window first and then segfaults
upon exit but I get the same error in gdb

gdb --args ruby -I lib /home/cvasilak/okcancel.rb


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7d0ab60 (LWP 9032)]
0xb5f4cf74 in ?? () from /lib/libselinux.so.1
(gdb) whe
#0 0xb5f4cf74 in ?? () from /lib/libselinux.so.1
#1 0xb5f4664e in ?? () from /lib/libselinux.so.1
#2 0xb5f3f100 in ?? () from /lib/libselinux.so.1
#3 0xb5f4e7bc in _fini () from /lib/libselinux.so.1
#4 0xb7fc1fdf in ?? () from /lib/ld-linux.so.2
#5 0xb7d39084 in exit () from /lib/tls/i686/cmov/libc.so.6
#6 0xb7effc85 in ruby_stop () from /usr/lib/libruby1.8.so.1.8
#7 0xb7f0acf1 in ruby_run () from /usr/lib/libruby1.8.so.1.8
#8 0x080486bd in main ()

Let me know if you need more information

Regards,
Christos

Hi

Christos Vasilakis wrote:

#0 0xb5f6bf74 in ?? () from /lib/libselinux.so.1

Thanks for running this. Unfortunately it seems that the debugging
information has got truncated - I guess because you are using a release
build of wxWidgets, and thus wxRuby tries to compile the smallest,
fastest possible.

If you were willing to try reproducing the error in a debug build, that
should give more information. There is libwx package in Ubuntu with the
-dbg suffix. If you install this, then run

export WXRUBY_DEBUG=1
rake reswig
rake

and then try re-running the same process, we should get a more helpful
backtrace. This is really puzzling as you have almost exactly the same
setup as me, except that i built my own ruby.

thanks
alex