malkia / ufo

Portable distribution of LuaJIT with precompiled binaries, libraries and FFI bindings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zlib.lua fails on Linux

opened this issue · comments

Probably others do as well, but I needed a complete FFI interface to zlib and found this one.

The problem is in the ffi.load line:

local zlib = ffi.load( ffi_zlib_lib or libs[ ffi.os ][ ffi.arch ] or "z" )

It should be:

local zlib = ffi.load( ffi_zlib_lib or libs[ ffi.os ] and libs[ ffi.os ][ ffi.arch ] or "z" )

The problem should be obvious from the fix (libs[ffi.os] not defined thus it crashes trying to access libs[ffi.os][ffi.arch]).