[issue34814] makesetup: must link C extensions to libpython when compiled in shared mode
STINNER Victor
report at bugs.python.org
Thu Sep 27 06:52:21 EDT 2018
STINNER Victor <vstinner at redhat.com> added the comment:
Ah, it seems like the bpo-832799 (reported in 2003) is similar to the RHEL bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1585201
Extract of the RHEL bug report:
---
pythontest.c:
#include <dlfcn.h>
int main(int argc, char *argv[])
{
void *pylib = dlopen("libpython2.7.so.1.0", RTLD_LOCAL | RTLD_NOW);
void (*Py_Initialize)(void) = dlsym(pylib, "Py_Initialize");
Py_Initialize();
int (*PyRun_SimpleStringFlags)(const char *, void *) = dlsym(pylib, "PyRun_SimpleStringFlags");
PyRun_SimpleStringFlags("import json\n", 0);
return 0;
}
2. Compile with "gcc -Wall -o pythontest pythontest.c -ldl -g"
3. Run ./pythontest -
Actual results:
it will fail with ImportError: /usr/lib64/python2.7/lib-dynload/_struct.so: undefined symbol: PyFloat_Type
---
The reporter is already aware of the fallback on RTLD_GLOBAL: "(optionally) change RTLD_LOCAL to RTLD_GLOBAL and see that it works".
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34814>
_______________________________________
More information about the Python-bugs-list
mailing list