Hi all,
I kind of figured out how to get PyTQt working:
The problem is this:
$ python3 -c "from PyTQt import tqt; print('SUCCESS:', dir(tqt)[:5])"
Traceback (most recent call last):
File "<string>", line 1, in <module>
from PyTQt import tqt; print('SUCCESS:', dir(tqt)[:5])
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/PyTQt/__init__.py", line 52, in <module>
from PyTQt import *
ImportError: /usr/lib/python3/dist-packages/PyTQt/tqt.cpython-314-x86_64-linux-gnu.so: undefined symbol: _ZN7TQMutex6lockedEv
The workaround that my AI helper found is this wrapper:
// tqtmutex_wrapper.cpp
// Wrapper for TQMutex::locked() ABI mismatch in python3-pytqt
//
// Problem: PyTQt expects _ZN7TQMutex6lockedEv (non-const member)
// libtqt3-mt only exports _ZNK7TQMutex6lockedEv (const member)
//
// Fix: Provide a wrapper that delegates the non-const call to the const version
//
// Compile:
// g++ -shared -fPIC -o libtqtmutex_wrapper.so tqtmutex_wrapper.cpp
//
extern "C" {
// Forward declare the const version that exists in libtqt3-mt.so.3
bool _ZNK7TQMutex6lockedEv(void* this_ptr);
// Provide the non-const version that PyTQt expects
bool _ZN7TQMutex6lockedEv(void* this_ptr) {
return _ZNK7TQMutex6lockedEv(this_ptr);
}
}
With this wrapper I can run any of the exaples from "pytqt-doc" like this:
$ LD_PRELOAD=./libtqtmutex_wrapper.so python3 /usr/share/doc/pytqt-doc/examples/tut1.py
So my question here is: how can this be fixed the propper way?
Nik
--
Please do not email me anything that you are not comfortable also sharing with the NSA, CIA ...