Bug 71316 - QtRuby : Segmentation fault when loading Qt
Summary: QtRuby : Segmentation fault when loading Qt
Status: RESOLVED FIXED
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-27 18:01 UTC by Frédéric COIFFIER
Modified: 2004-01-11 18:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric COIFFIER 2003-12-27 18:01:37 UTC
Version:           3.1.94 (using KDE KDE 3.1.94)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice) 
OS:          Linux

I've compiled the KDEBINDINGS of KDE3.0beta2 and the last CVS tree for QtRuby (and Kalyptus and Smoke).
When I launch any ruby script which requires Qt, I've the following error :

bash-2.05b$ ruby canvastest.rb
/usr/lib/ruby/site_ruby/1.8/i686-linux-gnu/Qt.so: [BUG] Segmentation fault
ruby 1.8.1 (2003-10-31) [i686-linux-gnu]

Segmentation fault
Comment 1 lypanov 2003-12-28 12:26:20 UTC
Subject: Re: [Kde-bindings]  New: QtRuby : Segmentation fault when loading Qt

On Sun, Dec 28, 2003 at 10:54:36AM +0000, Richard Dale wrote:
> On Saturday 27 December 2003 17:01, Fr??d??ric wrote:
> > Version:           3.1.94 (using KDE KDE 3.1.94)
> > Installed from:    Compiled From Sources
> > Compiler:          gcc (GCC) 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2,
> > propolice) OS:          Linux
> >
> > I've compiled the KDEBINDINGS of KDE3.0beta2 and the last CVS tree for
> > QtRuby (and Kalyptus and Smoke). When I launch any ruby script which
> > requires Qt, I've the following error :
> >
> > bash-2.05b$ ruby canvastest.rb
> > /usr/lib/ruby/site_ruby/1.8/i686-linux-gnu/Qt.so: [BUG] Segmentation fault
> > ruby 1.8.1 (2003-10-31) [i686-linux-gnu]
> >
> > Segmentation fault
> Can you try running under gdb to see where the seg fault is occuring? Alex 
> Kellett has had problems with QtRuby/ruby 1.8 seg faulting in pthreads code, 
> and he was using a more recent gcc than me. He said the workround was to 
> build ruby with pthreads enabled. I have no problem, and I'm using gcc 3.2.2. 
> I think it's some sort of library incompatibility. But I haven't tried ruby 
> 1.8.1 with qtruby yet though.

richard, which qt version are you running?
do you have a x86 box anywhere that you can test on?

my qt version is qt-copy previous to the 3.3 import
therefore, it would be 3.2.3 or so i guess.
my gcc version is also the stable gentoo compiler: gcc 3.2.3 
the actual backtrace i see can be stopped by compiling the
latest versions of ruby (maybe preview 3 or higher, cvs
for certain) with an option which makes it use pthread
locking to stop pthread related problems. 

when i put the seg faulting ruby into gdb (i.e, with a default ruby
compilation, no special flag) i can see a thread being started
for no apparent reason (well, unless gdb is doing this....)
[and shortly after it segfaults.

ruby 1.8 does the same. qt 3.1 on my work machine with the 
rest of the toolkit at exactly the same level as my home
machine (e.g, ruby, gcc, glibc, etc). *works*. no crash
on startup.

i've thought about workarounds for a while. but its 
really not the sort of stuff that i feel like working
on at the moment (wrappers that dlload Qt.so after doing
a pthread lock, blah blah blah)

i'll email the backtrace shortly. and the ruby configure
flag that works around it. and the code that ruby adds
that makes it work.

i've been unable as of yet to find the code in qt which
causes the crash unfortunately. so, i'll try to search for
thread related stuff later on in the week if i'm time.
   
mvg,
Alex

Comment 2 lypanov 2003-12-28 13:21:45 UTC
Subject: Re: [Kde-bindings]  New: QtRuby : Segmentation fault when loading Qt

On Sun, Dec 28, 2003 at 12:32:35PM +0100, Alexander Kellett wrote:
> i'll email the backtrace shortly. and the ruby configure
> flag that works around it. and the code that ruby adds
> that makes it work.

gdb output:

   $ gdb ruby
   (gdb) run rbqtapi
   Starting program: /usr/bin/ruby rbqtapi
   (no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...
   (no debugging symbols found)...(no debugging symbols found)...[New Thread 16384 (LWP 30108)]

   Program received signal SIGSEGV, Segmentation fault.
   [Switching to Thread 16384 (LWP 30108)]
   0x410d1785 in __pthread_unlock () from /lib/libpthread.so.0
   (gdb) bt
   #0  0x410d1785 in __pthread_unlock () from /lib/libpthread.so.0
   #1  0x410ced75 in pthread_mutex_unlock () from /lib/libpthread.so.0
   #2  0x40259bc9 in _dl_open () from /lib/libc.so.6
   #3  0x40100e88 in dlopen_doit () from /lib/libdl.so.2
   #4  0x4000adc6 in _dl_catch_error_internal () from /lib/ld-linux.so.2
   #5  0x40101286 in _dlerror_run () from /lib/libdl.so.2
   #6  0x40100ed4 in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2
   #7  0x400444fe in dln_load () from /usr/lib/libruby18.so.1.8
   #8  0x40057d43 in rb_require_safe () from /usr/lib/libruby18.so.1.8
   #9  0x400579eb in rb_f_require () from /usr/lib/libruby18.so.1.8
   #10 0x40066fb9 in call_cfunc () from /usr/lib/libruby18.so.1.8
   #11 0x40060e45 in rb_call0 () from /usr/lib/libruby18.so.1.8
   #12 0x40056454 in rb_call () from /usr/lib/libruby18.so.1.8
   #13 0x400521b8 in rb_eval () from /usr/lib/libruby18.so.1.8
   #14 0x400577c9 in rb_load () from /usr/lib/libruby18.so.1.8
   #15 0x40057dc6 in rb_require_safe () from /usr/lib/libruby18.so.1.8
   #16 0x400579eb in rb_f_require () from /usr/lib/libruby18.so.1.8
   #17 0x40066fb9 in call_cfunc () from /usr/lib/libruby18.so.1.8
   #18 0x40060e45 in rb_call0 () from /usr/lib/libruby18.so.1.8
   #19 0x40056454 in rb_call () from /usr/lib/libruby18.so.1.8
   #20 0x400521b8 in rb_eval () from /usr/lib/libruby18.so.1.8
   #21 0x4004ed01 in ruby_exec () from /usr/lib/libruby18.so.1.8
   #22 0x4004ed95 in ruby_run () from /usr/lib/libruby18.so.1.8
   #23 0x080486b3 in main ()
   #24 0x4016790b in __libc_start_main () from /lib/libc.so.6

Alex
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings

Comment 3 lypanov 2004-01-11 18:41:43 UTC
okay. i have a working fix in kde cvs now. for the moment i've only
created the fix for korundum (kde bindings) but i can if wanted add
a version of the fix that only requires qtruby for 3.2.1.

read the file README.1st, that describes in short how to stop
it from segv'ing on startup. basically it involves putting a 
symlink named "ruby" pointing to the program krubyinit (found 
in korundum/bin) in your PATH.

mvg,
Alex