kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #13688
Re: Fwd: pcbnew crashes on start since #4757 because of libpython not loaded
Hello,
I come back on this issue to give some pieces of analysis.
This issue is kicad bug #1299217
(https://bugs.launchpad.net/kicad/+bug/1299217)
Actual facts:
When compile with option :
KICAD_SCRIPTING_WXPYTHON=ON
Pcbnew crash at startup with an error:
Traceback (most recent call last):
File
"/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/__init__.py",
line 45, in <module>
from wx._core import *
File
"/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line
4, in <module>
import _core_
ImportError:
/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so:
undefined symbol: PyExc_ValueError
So I had try to investigate this point and I found that:
- libpython is correctly loaded at runtime (LD_DEBUG=all pcbnew)
=> It is loaded because DSO _pcbnew.kiface depend to libpython
- pcbnew is not linked with libpython (of course, it doesn't use it
directly...)
- /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so is
loaded by an embedded python scripts at python_scripting.cpp
- this _core_.so is NOT linked with libpython
=> I have check on my distribution: on 307 binary python module I have
only 20 linked to libpython (including _pcbnew.so...)
=> perhaps it is supposed to run inside a already load python system
(like /usr/bin/python...) and it is not need to relink to python
- This old bug http://bugs.python.org/issue4434 look to be exactly the
same case
- libpython is not visible from other libs since at common/kiway.cpp the
kiface dso is loaded *without* wxDL_GLOBAL
So a fix could be to add wxDL_GLOBAL to the dso.Load (line 160 of
common/kiway.cpp)
Additionnaly _pcbnew.so should not be linked to libpython since when
loading it on python, python's symbols are already loaded. All other
python binary libs don't link to libpython at all.
What do you think ?
Le 04/04/2014 19:15, Dick Hollenbeck a écrit :
>
>>> I have try to find a solution by trace the library loading:
>>> LD_DEBUG=all pcbnew
>>> But the issue look to be due to a compilation option on some ubuntu
>>> libs. Anyway I'm NOT sure of that...
>
> This is the right path to an understanding. It's just that full source level debugging is
> needed to see into libpython.so. I don't think same for wxPython is needed, since the
> crash is in libpython.so.
>
> It is a bit time consuming getting wxPython to be happy with a substitute libpython.so
> (debug) and then capture the crash under a debugger, but this will begin to shed light.
>
> It may be related to thread local storage or something. The differences in the crash
> scenario and no crash are:
>
> 1) libpython is loaded as a load time dependency on the DSO in one case, vs. a load time
> dependency on the EXE in the other
>
> 2) The DSO which depends on libpython, namely _pcbnew.kiface, is not loaded precisely at
> at process startup time, but upon a dlopen() call later in time.
>
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
Follow ups
References