libtcod / python-tcod

A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
BSD 2-Clause "Simplified" License
413 stars 36 forks source link

tcod.event breaks on 32-bit systems. "SDL_TouchFingerEvent: wrong total size" #74

Closed HexDecimal closed 5 years ago

HexDecimal commented 5 years ago

SDL2 uses 4-byte alignment on 32-bit architectures, but cffi expects alignment to be MSVC's default of 8-bytes. The latest version of cffi detects this discrepancy and raises this error:

File "...\lib\site-packages\tcod\event.py", line 585, in get
    sdl_event = tcod.ffi.new("SDL_Event*")
ffi.error: struct SDL_TouchFingerEvent: wrong total size (cdef says 48, but C compiler says 44). fix it or use "...;" in the cdef for struct SDL_TouchFingerEvent to make it flexible

The current workaround is to install the 64-bit version of Python or to pin a slightly earlier version of cffi using pip, specifically: pip install "cffi==1.12.2"

A fix would mean a rewrite of the header parser code, which needs to be rewritten anyway.