diff --git a/src/PythonQt.cpp b/src/PythonQt.cpp index 288ae57f..3d881450 100644 --- a/src/PythonQt.cpp +++ b/src/PythonQt.cpp @@ -339,20 +339,22 @@ PythonQt* PythonQt::self() { return _self; } PythonQt::PythonQt(int flags, const QByteArray& pythonQtModuleName) { -#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8 && defined(__linux__) +// #if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8 && defined(__linux__) /* Starting from python 3.8, python C extensions no longer link to libpython3.X.so - This is a problem, since libpython3.X.so is loaded through a reference in libtrikScriptRunner.so + This is a possible problem, since libpython3.X.so is loaded through a reference in libtrikScriptRunner.so and (somehow) ld.so does not place it's symbols into global symbol table. This results into a failure to load any C module. Loading libpython3.X.so with dlopen and RTLD_GLOBAL flag effectively solves this issue. */ // TODO: Someting like PyRun_String("sysconfig.get_config_var('LDLIBRARY')") // should be used to extract shared object name for current interpreter - const auto &libName = QString("libpython3.%1.so.1.0").arg(PY_MINOR_VERSION).toStdString(); - if (NULL == dlopen(libName.c_str(), RTLD_GLOBAL | RTLD_LAZY)) { - qFatal("Failed to load %s", libName.c_str()); - abort(); - } -#endif + +// NOTE 2023-07-07: On Centos7 .so is a link named `libpython3.8.so` and points to `libpython3.8.so.rh-python38-1.0` +// const auto &libName = QString("libpython3.%1.so.1.0").arg(PY_MINOR_VERSION).toStdString(); +// if (NULL == dlopen(libName.c_str(), RTLD_GLOBAL | RTLD_LAZY)) { + //qFatal("Failed to load %s", libName.c_str()); + //abort(); +// } +// #endif _p = new PythonQtPrivate; _p->_initFlags = flags;