Combine wxLua with LuaJIT on Mac OS X

1.1k Views Asked by At

How do you build wxLua on Mac OS X (10.6.8) so that it uses LuaJIT2 instead of the standard Lua interpreter?

I have tried:

./configure --with-lua-prefix=/Users/finnw/LuaJIT-2.0.0-beta9

where /Users/finnw/LuaJIT-2.0.0-beta9 is the directory in which I built LuaJIT.

I have also tried copying src/libluajit.a to lib/liblua5.1.a and src/libluajit.so to lib/liblua5.1.so and various other combinations such as changing the extension from .so to .dylib

But still I always get Lua not LuaJIT (as can be verified by loading a script that requires the ffi module.)

How can I force it to link against LuaJIT2? And why does the configure --with-lua-prefix option not do what it claims to do?

1

There are 1 best solutions below

7
On

The following works on Debian:

$ ./configure --with-lua-prefix=/path/to/luajit --enable-systemlua

which points at /path/to/luajit/include/lua5.1/*.h and /path/to/luajit/lib/liblua5.1.a.

--enable-systemlua ensures that it tries to find Lua at the prefix you specify, and will make configure fail rather than fall back on the Lua bundled with wxLua.

You'll also need to replace the two instances of luaI_openlib in wxlbind.cpp and wxlstate.cpp with luaL_openlib, as this is deprecated in 5.1 and not present in LuaJIT2.