On Tue, Apr 26, 2016 at 03:15:53PM +1000, Jonathan Gray wrote: > 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)." >
with lua52 flavour of luaposix $ 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 > errno = require "posix.errno" luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_pcallk' luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_tointegerx' luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_tonumberx' luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_rawlen' luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'luaL_setfuncs' error loading module 'posix.errno' from file '/usr/local/lib/lua/5.2/posix.so': Cannot load specified object stack traceback: [C]: at 0x0795feb501c0 [C]: in function 'require' stdin:1: in main chunk [C]: at 0x0795feb07d90 > $ lua52 Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio > errno = require "posix.errno" > with luaposix without a flavour $ luajit51 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 > errno = require "posix.errno" >