[kde-freebsd] [Call for Help] kpythonpluginfactory (Printer Configuration)

David Naylor naylor.b.david at gmail.com
Sat Oct 31 09:26:55 CET 2009


On Friday, 30 October 2009 18:25:17 Kris Moore wrote:
> On Fri, 30 Oct 2009, David Naylor wrote:
> > Hi,
> >
> > It appears that kpythonpluginfactory does not work when the python script
> > calls a lib-dynload object (such as 'import time').  A typical message
> > is:
> >
> > ImportError: /usr/local/lib/python2.6/lib-dynload/time.so: Undefined
> > symbol "PyExc_IOError"
> >
> > This stops system-settings-printer-kde from working (and, I think plasma-
> > python scripting).  I know this worked in KDE 4.2.0.  A tentative
> > speculation to the cause leads me to conclude something happened to
> > FreeBSD (I still needs to do an upgrade to RC2)*.
> >
> > I did, however, find a work around: get kpythonpluginfactory to link
> > statically to python.  This obviously leads to a bigger file.
> >
> > Does anyone have KDE <4.2.2 running, if so please install
> > print/system-config- printer-kde and see if you can load the "Printer
> > Configuration" in systemsettings.  Please report if the config module
> > loads and what version of KDE and FreeBSD you are running.
> >
> > Thanks,
> >
> > David
> >
> > *I'm also having problems with cups-smb and this may be related
> 
> David,
> 
> I did some investigation with this issue a while back. I think its a bug in
>  the python port itself, none of the lib-dynload libraries are linked to
>  the main python library. For example, if you run this:
> 
> setenv LD_PRELOAD "/usr/local/lib/libpython2.6.so" ; systemsettings
> 
> You should now be able to bring up the KDE printer interface. If you do
>  this, you can see what those libs are linked to:
> 
> # cd /usr/local/lib/python2.6/lib-dynload
> # setenv LD_LIBRARY_PATH `pwd`
> # ldd time.so
> time.so:
>  	libm.so.5 => /lib/libm.so.5
>  	libthr.so.3 -> /lib/libthr.so.3
>  	libc.so.7 => /lib/libc.so.7
> 
> I'm thinking that if we fix the python port to link these lib-dynload/*
>  libaries to /usr/local/lib/libpython2.6.so the problem will go away.
>  Investigating this now actually, but if somebody else had ideas on this,
>  please let us know :)

This is actually a design feature of python.  If those libraries are linked to 
libpython then it will break the case where one links statically to libpython.  
See http://bugs.python.org/issue4434 for the PR at python that discusses it.  

The way to get around this is to dlopen libpython with RTLD_GLOBAL.  I've 
checked the code in kpythonpluginfactory and that is exactly what it does.  
That behaviour has never changed.  

I do remember this working for me a while back and stopped after I did a 
system wide upgrade.  This, I presume, also works for Linux.  

I'm planning on upgrading to RC2 and if the issue is still present I'll write 
a simple test program that should exhibit the same behaviour and check to see 
if it works on older versions of FreeBSD.  

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-freebsd/attachments/20091031/5206c0a5/attachment.sig 


More information about the kde-freebsd mailing list