If the bit32 compat lua module is built against lua 5.2 and used with
luajit52 it fails with:

$ luajit52  
LuaJIT 2.0.4 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> bit32 = require "bit32"
luajit52:/usr/local/lib/lua/5.2/bit32.so: undefined symbol 'luaL_checkunsigned'
luajit52:/usr/local/lib/lua/5.2/bit32.so: undefined symbol 'lua_pushunsigned'
luajit52:/usr/local/lib/lua/5.2/bit32.so: undefined symbol 'luaL_setfuncs'
error loading module 'bit32' from file '/usr/local/lib/lua/5.2/bit32.so':
        Cannot load specified object
stack traceback:
        [C]: at 0x160e11850290
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: at 0x160e11807d90

Building against the luajit headers instead of the lua 5.2 headers seems
to fix this.

Building against lua 5.1 headers and using luajit51 seems to work.

But the real problem seems to be that luajit with the minimal 5.2 compat
flag enabled is abi compatible with lua 5.1 not lua 5.2.  The port
incorrectly changes this so it can use lua.port.mk with the FLAVOR.

http://luajit.org/extensions.html

"Note: this provides only partial compatibility with Lua 5.2 at the
language and Lua library level. LuaJIT is API+ABI-compatible with
Lua 5.1, which prevents implementing features that would otherwise break
the Lua/C API and ABI (e.g. _ENV)."

Reply via email to