[PyKDE] qtgl segfault problem (PyQt-3.0)

Robert Cimrman cimrman3 at ntc.zcu.cz
Tue Feb 19 15:13:15 GMT 2002


I have a similar problem as described below in the post by Tad Thurston, 
however I use Redhat 7.2. I have tried to compile PyQt-3.0 plus sip-3.0 
for both python1.5 and python2.1 with the same result - a segfault 
whenever something form qtgl module gets called. I have included the 
offending code and gdb backtrace, see below. The code dumps core on 'if 
not QGLFormat.hasOpenGL():' line (-> only '1' is displayed). If this 
part is  commented out, it "cores" at 
'QGLWidget.__init__(self,parent,name)' line (hence printing 1, 2, 3).

Can anyone tell me what to do to make it work?
Thanks for reading this (and potentialy helping me :')),
Robert Cimrman
  (Another newbie wanting to develop cool 3D graphic apps in python)

Tad Thurston wrote:
 > > Hi all,
 > > I am rather a newbie at Python, but I would like to start focusing my
 > development there using the PyQt module.  I am using debian, but the deb
 > package did not install a qtgl library, so I compiled the sip 2.5 and
 > PyQt sources myself.  Everything went ok, except that I had to hand-edit
 > the makefiles to include -lqt-gl (that's the debian name for the OpenGL
 > Qt extension) along with -lqt.  All the demos run fine, but when I
 > include
 > > from qtgl import *
 > > then I get a segfault (like in the gears examples).  I am new to 
 > so I don't know how to go about finding out where the problem is.  Any
 > help would be appreciated.  I am using Linux with the latest 1.541
 > NVidia drivers.  All my other OpenGL apps run fine.
 > > Please cc me on replies, since I haven't received the notification 
that I'm
 > subscribed to the list.  Thanks in advance for any help.


#!/usr/bin/env python
import sys
from qt import *
from qtgl import *

class GearWidget(QGLWidget):
     def __init__(self,parent=None,name=None):
         print "3"
         print "4"

a = QApplication(sys.argv)

print "1"

if not QGLFormat.hasOpenGL():
     raise 'No Qt OpenGL support.'

print "2"
w  = GearWidget()



Core was generated by `python2.1 ./gear.py'.
P(gdb) bt
#0  0x00000000 in ?? ()
#1  0x409cbd86 in QGLFormat::hasOpenGL () from 
#2  0x40d1c241 in sipDo_QGLFormat_hasOpenGL ()
    from /usr/lib/python2.1/site-packages/libqtglcmodule.so
#3  0x080593ed in PyEval_CallObjectWithKeywords ()
#4  0x08057c75 in PyEval_EvalCode ()
#5  0x080550d5 in PyEval_EvalCode ()
#6  0x0806e031 in PyRun_FileExFlags ()
#7  0x0806d34f in PyRun_SimpleFileExFlags ()
#8  0x08051f30 in Py_Main ()
#9  0x4008d306 in __libc_start_main (main=0x80519d0 <main>, argc=2,
     ubp_av=0xbffff764, init=0x8050e38 <_init>, fini=0x80a48f0 <_fini>,
     rtld_fini=0x4000d2cc <_dl_fini>, stack_end=0xbffff75c)
     at ../sysdeps/generic/libc-start.c:129

More information about the PyQt mailing list