Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Symbol _ZThn712_N9wxListBox13DoInsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType #2486

Open
xloem opened this issue Nov 26, 2023 · 7 comments

Comments

@xloem
Copy link

xloem commented Nov 26, 2023

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
Copy link
Collaborator

swt2c commented Nov 27, 2023

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
Copy link
Author

xloem commented Nov 28, 2023

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
Copy link
Collaborator

swt2c commented Nov 28, 2023

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

@xloem
Copy link
Author

xloem commented Nov 28, 2023

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
Copy link
Author

xloem commented Nov 28, 2023

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

@swt2c
Copy link
Collaborator

swt2c commented Nov 28, 2023

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
Copy link
Author

xloem commented Nov 28, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants