Reputation: 4781
I have Linux Ubuntu x64 14.04 with Python 3.4 installed (default installation by Ubuntu).
If I open CudaText text editor, it cannot import ctypes
in console:
>>>> import ctypes
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.4/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: /usr/lib/python3.4/lib-dynload/_ctypes.cpython-34m-x86_64-linux-gnu.so: undefined symbol: PyFloat_Type
Seems like Py3.4 installation is not full? Why it cannot load ctypes?
Upvotes: 1
Views: 1993
Reputation: 34300
In Debian Linux distros such as Ubuntu, Python extension modules are built assuming Python's symbols are loaded globally, so they don't explicitly list the Python lib as a requirement in the ELF header. An embedding application that links dynamically needs to load the Python shared library to the global symbol table, e.g. dlopen("libpython3.4m.so", RTLD_GLOBAL | RTLD_NOW)
.
The author of the CudaText editor is using Python for Lazarus. I presume this uses dynlibs. As you can see in the source, it does not call dlopen
with RTLD_GLOBAL
. The default is RTLD_LOCAL
(0).
Upvotes: 1