Skip to content

Commit f8b4222

Browse files
author
m32
committed
finding usable shared library since /usr/lib/x86_64-linux-gnu/libpython3.11.so is from python3-dev package
1 parent ec6b728 commit f8b4222

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

python/src/python.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,18 @@ PYTHON_LOG("initial sys.path=%s\n", syspath.c_str());
200200
pluginPath.resize(pos);
201201
}
202202

203-
PYTHON_LOG("pluginpath: %s, python library used:%s\n", pluginPath.c_str(), PYTHON_LIBRARY);
204-
soPythonInterpreter = dlopen(PYTHON_LIBRARY, RTLD_NOW | RTLD_GLOBAL);
203+
std::string pythonso = PYTHON_LIBRARY;
204+
PYTHON_LOG("pluginpath: %s, python library used:%s\n", pluginPath.c_str(), pythonso.c_str());
205+
soPythonInterpreter = dlopen(pythonso.c_str(), RTLD_NOW | RTLD_GLOBAL);
205206
if( !soPythonInterpreter ){
206-
PYTHON_LOG("error %u from dlopen('%s')\n", errno, PYTHON_LIBRARY);
207-
initok = false;
208-
return;
207+
PYTHON_LOG("error %u from dlopen('%s'): %s\n", errno, pythonso.c_str(), dlerror());
208+
pythonso += ".1";
209+
soPythonInterpreter = dlopen(pythonso.c_str(), RTLD_NOW | RTLD_GLOBAL);
210+
if( !soPythonInterpreter ){
211+
PYTHON_LOG("error %u from dlopen('%s'): %s\n", errno, pythonso.c_str(), dlerror());
212+
initok = false;
213+
return;
214+
}
209215
}
210216

211217
initok = init_python();

0 commit comments

Comments
 (0)