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

Kris Moore kris at pcbsd.org
Mon Nov 2 19:42:47 CET 2009



On Sat, 31 Oct 2009, David Naylor wrote:

> On Saturday, 31 October 2009 10:26:55 David Naylor wrote:
>> 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.
>
> It still does not work under RC2.  I am now doubting this is a regression and
> it was planetary alignments that had it working for me previously :-)
>
> I wrote a test program that *should* trigger the same problem.  See
> rtld_global.shar for the program.  The default behaviour is my fix, to trigger
> the problem run `make -DTRIGGER`.  It is a small program and should be easy to
> figure out.
>
> See attached for the fix.  Add the patch to devel/kdebindings4-python-pykde4
> and reinstall.
>
> If you encounter any problems please let me know.
>
> Regards

Excellent! I've tested this patch here, and it does correct issues with the python printer
app on my 8.0-RC2 (amd64) system. I've just added it to area51 now as well.

Thanks!

--
Kris Moore
PC-BSD Software


More information about the kde-freebsd mailing list