[PyQt] Re: PyQT4 always 'Segmentation fault' ,help me please

Danny Pansters danny at ricin.com
Thu May 3 19:57:17 BST 2007


On Wednesday 02 May 2007 07:55:52 haiyun jiang wrote:
> 2007/5/1, haiyun jiang <jiang.haiyun at gmail.com>:
> > Hi,
> >
> > I am having some serious problems with *PyQT4*,
> > when i run pyqt script, I always get 'Segmentation *fault*'.
<snip>
> > Segmentation *fault* (core dumped)
<snip>
> > My system is FreeBSD 6.2 release, i386, all softwares were installed
> > from ports.
> > and the Qt4 examples/demos work perfectly.
> > It seems to have no useful hint at google.
<snip>
>
> Last night, I portupgraded gettext(it took a long time, though)
> and now the problem has disappeared. I tested the  example script
> tetrix.py, it ran smoothly.

Well, seems that your ports were out of sync. Almost *everything* depends 
libintl, including Python itself. Please note that most people on this list 
don't know FreeBSD's ports system or portupgrade. This was merely a ports 
problem. But I have to admit, a peculiar one.

> Before portupgrade gettext, I have got a runtime error something like
> "shared library libintl.so.8  not found"(the system only has the
> libintl.so.6 that time) when ran PyQT4 script, and this was caused by

That's the trouble. Library version mismatch. The PyQt4 ports were added just 
after the gettext version bump occured. 

> the lower version of gettext, so I deleted it and reinstalled
> gettext0.16.1_1, then libintl.so.6 was replaces by libintl.so.8. But some
> other programs complained that they can't find libintl.so.6, so I  linked
> libintl.so.8 to libintl.so.6.

That will not work correctly, as you've noticed :)

> At that point, I got the preceding problem(PyQT4 script always crashes).
> So I think the problem may be caused by 'PyQt4' mismatches 'gettext'.
> And there may be a simple solution :)

Yes, by forcing a rebuild of all your ports, as you've noticed :)

Here's what I get. It works as intended:
%python
Python 2.4.4 (#2, Feb 24 2007, 14:28:09)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtGui, QtCore
>>> import sys
>>> app = QtGui.QApplication(sys.argv)
>>> w = QtGui.QMainWindow()
>>> w.show()
>>> app.exec_()
0
>>>

But I do have:
%gettext --version
gettext (GNU gettext-runtime) 0.16.1
Copyright (C) 1995-1997, 2000-2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Ulrich Drepper.

But look:
%ldd /usr/local/lib/python2.4/site-packages/PyQt4/QtCore.so | grep libintl
        libintl.so.6 => /usr/local/lib/compat/pkg/libintl.so.6 (0x28760000)

This is done by portupgrade, keeping older library version around in 
compat/pkg. I think I must have gotten it when upgrading Qt because:
%ldd /usr/local/lib/libQtCore.so.4.2.3 | grep libintl
        libintl.so.6 => /usr/local/lib/compat/pkg/libintl.so.6 (0x28519000)

If merely installing from ports you don't get such backup libs so there's no 
such safety belt for already-linked other apps/libs. So I got lucky (for 
once).

Underneath this of course lies some brokenness in ports system when it comes 
to version bumps in critical libs. I think because the dependency chain is 
just too big, and these kinds of libs are in most ports implicit 
dependencies, not explicit. I might be wrong, but I don't think the 
committers even try to track them. They're happy when ports compile on the 
cluster. Runtime testing is up the the port maintainer and, yup, the users. 
This kind of problems are the downside of having a source based system that 
is subject to change all the time. And they're almost impossible to 
replicate. This is also a very important reason why reliable binary packages 
can only be made from a "frozen" ports tree. Practically speaking, that is 
when a RELEASE is made.

OK, rant off. Glad it works for you now! Please use this list only for PyQt 
programming questions. For port problems, contact me directly or send to 
ports at freebsd.org.

Cheers,

Dan


More information about the PyQt mailing list