wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.23k stars 510 forks source link

Undefined Symbol _ZThn712_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType #2486

Open xloem opened 6 months ago

xloem commented 6 months ago

Operating system: Red Hat Enterprise Linux 7.7 wxPython version & source: I've tried both pip and git tag wxPython-4.2.1 Python version & source: 3.10.11 self-built I think from 425065bb002b9cbf9c12f61a6f3102f2ce2b8d14

Description of the problem: When I import wx, I get

>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/shared/src/wxpython-Phoenix/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/shared/src/wxpython-Phoenix/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: /shared/src/wxpython-Phoenix/wx/_core.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZThn712_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType

Note:

[user@localhost wxpython-Phoenix]$ echo _ZThn712_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType | c++filt
non-virtual thunk to wxListBox::DoInsertItems(wxArrayStringsAdapter const&, unsigned int, void**, wxClientDataType)
[user@localhost wxpython-Phoenix]$ grep -r _ZThn712_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType
ext/wxWidgets/build/elfabi/libwx_gtk3u_core-3.2.abi:    <elf-symbol name='_ZThn712_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType' version='WXU_3.2' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
grep: wx/_core.cpython-310-x86_64-linux-gnu.so: binary file matches
grep: build/waf/3.10/gtk3/sip/cpp/sip_corewxListBox.cpp.3.o: binary file matches
grep: build/waf/3.10/gtk3/sip/cpp/sip_corewxCheckListBox.cpp.3.o: binary file matches
grep: build/waf/3.10/gtk3/_core.cpython-310-x86_64-linux-gnu.so: binary file matches
grep: build/lib.linux-x86_64-cpython-310/wx/_core.cpython-310-x86_64-linux-gnu.so: binary file matches
swt2c commented 6 months ago

Seems like perhaps you have an outdated wxwidgets library in your path (ie, your grep should be finding a libwx_gtk3u_core*.so file).

xloem commented 6 months ago

Thanks a bunch.

This is what I have so far:

$ objdump -t wx/libwx_gtk3u_core-3.2.so | grep _N9wxListBox13DoInsertItemsERK21wxArrayStrings
AdapterjPPv16wxClientDataType
0000000000415460 l     F .text  000000000000000c              _ZThn640_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType.localalias
0000000000415460 g     F .text  000000000000000c              _ZThn640_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType

The virtual base offset is 640 instead of 712. I found on stackoverflow this might be from configuration changes when including the header.

It turns out I do have a system binary installed but it also has the symbol listed with 640 rather than 712:

$ objdump -T /usr/lib64/libwx_gtk3u_core-3.0.so.0.4.0 | grep _N9wxListBox13DoInsertItemsERK21
wxArrayStringsAdapterjPPv16wxClientDataType
00000000002ec810 g    DF .text  000000000000000c  WXU_3.0     _ZThn640_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType
swt2c commented 6 months ago

I wonder if perhaps your system copy of wxWidgets config files got used somehow? Do you have any build logs available?

xloem commented 6 months ago

It looks like wxListBox has an extra base class of wxItemContainer in the sip file. I'm not familiar with sip.

$ grep -r class.wxListBox
ext/wxWidgets/include/wx/listbox.h:// wxListBox interface is defined by the class wxListBoxBase
ext/wxWidgets/interface/wx/listbox.h:    @class wxListBox
ext/wxWidgets/interface/wx/listbox.h:class wxListBox : public wxControl,
ext/wxWidgets/src/msw/listbox.cpp:class wxListBoxItem : public wxOwnerDrawn
sip/gen/listbox.sip:class wxListBox : wxControl, wxItemContainer
sip/gen/listbox.sip:};  // end of class wxListBox
xloem commented 6 months ago

I'll rebuild logging output. It takes a while.

swt2c commented 6 months ago

It looks like wxListBox has an extra base class of wxItemContainer in the sip file. I'm not familiar with sip.

$ grep -r class.wxListBox
ext/wxWidgets/include/wx/listbox.h:// wxListBox interface is defined by the class wxListBoxBase
ext/wxWidgets/interface/wx/listbox.h:    @class wxListBox
ext/wxWidgets/interface/wx/listbox.h:class wxListBox : public wxControl,
ext/wxWidgets/src/msw/listbox.cpp:class wxListBoxItem : public wxOwnerDrawn
sip/gen/listbox.sip:class wxListBox : wxControl, wxItemContainer
sip/gen/listbox.sip:};  // end of class wxListBox

Yes, the .sip file should match the ext/wxWidgets/interface header, which it seems to. The actual inheritance hierarchy is a lot more complicated (go read the headers for wxListBox in ext/wxWidgets/include/).

xloem commented 6 months ago

Here's a build.log.

I missaw the comma. You're right the classes match.

It seems surprising to me that the virtual functions are in a different order between the interface header and the main header; do you know how binary compatibility is maintained given the virtual member functions are declared in a different order?