【问题标题】:Error importing ctypes python module - RuntimeError: ffi_prep_closure failed with 2导入 ctypes python 模块时出错 - RuntimeError: ffi_prep_closure failed with 2
【发布时间】:2014-07-08 11:48:17
【问题描述】:

导入 ctype python 模块时,出现以下错误:

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

如果需要更多信息,请告诉我。

谢谢

【问题讨论】:

  • 在 x86_64 平台上没有问题,但在 ppc p2020ds 和 octeon 2 平台上出现此问题。
  • 似乎 ffi_prep_closure_loc() 返回 FFI_BAD_ABI (value2)。所以它的一些工具链问题?与 ppc p2020ds 和 octeon 2 平台一样,x86_64 和问题都可以正常工作。

标签: python django python-2.7 ctypes linux-toolchain


【解决方案1】:

由于pyton使用的FFI来自libffi。

解决了以下路径问题:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-03
    • 2010-11-25
    相关资源
    最近更新 更多