You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I want to use PythonQt inside a plugin, and import dlib in a Python script. A plugin is actually a shared object loaded via dlopen (linux).
Unfortunately in my case I cannot influence which flags are passed to dlopen when loading my plugin, in the debugger I saw that this is RTLD_NODELETE | RTLD_LAZY. If I understand correctly, since there is no RTLD_GLOBAL flag, all loaded libraries from my plugin will not see any symbols, including those from my plugin.
When a Python script imports dlib, it dlopens _dlib_pybind11.cpython-311.so and fails because the library cannot see the symbol PyInstanceMethod_Type from libpython3.11.so, although this symbol is clearly available inside my plugin, since this library is dynamically linked.
I managed to do something - if you specify this object (_dlib_pybind11.cpython-311.so) during compilation to the linker, and then explicitly use any symbol from it, import dlib occurs successfully. But this is a hack that most likely won't be possible to use.
Is the situation really hopeless (and no Python package containing DSO can be used in my situation), or am I missing something?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Let's say I want to use PythonQt inside a plugin, and import
dlib
in a Python script. A plugin is actually a shared object loaded viadlopen
(linux).Unfortunately in my case I cannot influence which flags are passed to
dlopen
when loading my plugin, in the debugger I saw that this isRTLD_NODELETE | RTLD_LAZY
. If I understand correctly, since there is noRTLD_GLOBAL
flag, all loaded libraries from my plugin will not see any symbols, including those from my plugin.When a Python script imports
dlib
, it dlopens_dlib_pybind11.cpython-311.so
and fails because the library cannot see the symbolPyInstanceMethod_Type
fromlibpython3.11.so
, although this symbol is clearly available inside my plugin, since this library is dynamically linked.I managed to do something - if you specify this object (
_dlib_pybind11.cpython-311.so
) during compilation to the linker, and then explicitly use any symbol from it, importdlib
occurs successfully. But this is a hack that most likely won't be possible to use.Is the situation really hopeless (and no Python package containing DSO can be used in my situation), or am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions