Yubico / yubikey-manager-qt

Cross-platform application for configuring any YubiKey over all USB interfaces.
https://developers.yubico.com/yubikey-manager-qt/
BSD 2-Clause "Simplified" License
237 stars 30 forks source link

missing Symbol: Py_AddObject #342

Open 0-wiz-0 opened 1 year ago

0-wiz-0 commented 1 year ago

I've packaged yubikey-manager-qt-1.2.5 for pkgsrc using pyotherside 1.6.0 and qt5. When I start it up, I see:

"PyOtherSide error: ImportError: PyCapsule_Import could not import module \"datetime\"\n\n\nThe above exception was the direct cause of the following exception:\n\n\nTraceback (most recent call last):\n\n  File \"<frozen site>\", line 212, in addsitedir\n\n  File \"<frozen site>\", line 149, in _init_pathinfo\n\nSystemError: <class 'set'> returned a result with an exception set\n"
qml: Return value of PyObject call is NULL: ImportError: PyCapsule_Import could not import module "datetime"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "<frozen site>", line 212, in addsitedir

  File "<frozen site>", line 149, in _init_pathinfo

SystemError: <class 'set'> returned a result with an exception set

"PyOtherSide error: Traceback (most recent call last):\n\n  File \"qrc://io/thp/pyotherside/qrc_importer.py\", line 21, in <module>\n\n  File \"/usr/pkg/lib/python3.11/importlib/abc.py\", line 19, in <module>\n    from .resources.abc import ResourceReader, Traversable, TraversableResources\n\n  File \"/usr/pkg/lib/python3.11/importlib/resources/__init__.py\", line 3, in <module>\n    from ._common import (\n\n  File \"/usr/pkg/lib/python3.11/importlib/resources/_common.py\", line 3, in <module>\n    import tempfile\n\n  File \"/usr/pkg/lib/python3.11/tempfile.py\", line 45, in <module>\n    from random import Random as _Random\n\n  File \"/usr/pkg/lib/python3.11/random.py\", line 49, in <module>\n    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil\n\nImportError: /usr/pkg/lib/python3.11/lib-dynload/math.so: Undefined PLT symbol \"PyModule_AddObject\" (symnum = 4)\n"
qml: Cannot exec qrc importer: Traceback (most recent call last):

  File "qrc://io/thp/pyotherside/qrc_importer.py", line 21, in <module>

  File "/usr/pkg/lib/python3.11/importlib/abc.py", line 19, in <module>
    from .resources.abc import ResourceReader, Traversable, TraversableResources

  File "/usr/pkg/lib/python3.11/importlib/resources/__init__.py", line 3, in <module>
    from ._common import (

  File "/usr/pkg/lib/python3.11/importlib/resources/_common.py", line 3, in <module>
    import tempfile

  File "/usr/pkg/lib/python3.11/tempfile.py", line 45, in <module>
    from random import Random as _Random

  File "/usr/pkg/lib/python3.11/random.py", line 49, in <module>
    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil

ImportError: /usr/pkg/lib/python3.11/lib-dynload/math.so: Undefined PLT symbol "PyModule_AddObject" (symnum = 4)

"PyOtherSide error: No module named 'yubikey'"
qml: Cannot import module: yubikey (No module named 'yubikey')
"PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'yubikey' is not defined\n"
qml: Function not found: 'yubikey.init' (Traceback (most recent call last):

  File "<string>", line 1, in <module>

NameError: name 'yubikey' is not defined
)

The symbol is provided by libpython3.11.so, and /usr/pkg/qt5/qml/io/thp/pyotherside/libpyothersideplugin.so is linked against this library; however ykman-gui is not.

When I link ykman-gui against libpython manually, e.g. using

SUBLIBS=-lpython3.11

it starts up fine.

The generated file ykman-gui/Makefile has:

LIBS         += $(SUBLIBS) -L/usr/pkg/lib /usr/pkg/qt5/lib/libQt5QuickControls2.so /usr/pkg/qt5/lib/libQt5Quick.so /usr/pkg/qt5/lib/libQt5Widgets.so /usr/pkg/qt5/lib/libQt5Gui.so /usr/pkg/qt5/lib/libQt5QmlModels.so /usr/pkg/qt5/lib/libQt5Qml.so /usr/pkg/qt5/lib/libQt5Network.so /usr/pkg/qt5/lib/libQt5Core.so -lGL   

so it already explicitly links against all the other libraries that pyotherside uses.

If you think this is a bug in pyotherside instead (or the packaging), please let me know. Thanks!