Search code examples
pythondjangopython-2.7ctypeslinux-toolchain

Error importing ctypes python module - RuntimeError: ffi_prep_closure failed with 2


While importing ctype python modules,I got following error:

root@root# python

Python 2.7.3 (default, Jul  7 2014, 18:10:53) 
[GCC 4.7.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import ctypes

Traceback (most recent call last):

  File "stdin", line 1, in "module"

  File "/usr/lib32/python2.7/ctypes/__init__.py", line 555, in "module"

    _reset_cache()
  File "/usr/lib32/python2.7/ctypes/__init__.py", line 279, in _reset_cache

    CFUNCTYPE(c_int)(lambda: None)
RuntimeError: ffi_prep_closure failed with 2
>>> 

Please let me know if more info needed.

Thanks


Solution

  • Its due to FFI used by pyton is from libffi.

    With following path issue is resloved:

    https://gcc.gnu.org/viewcvs/gcc/trunk/libffi/src/mips/ffi.c?r1=190696&r2=190695&pathrev=190696