1

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?

0

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.