3

How do I configure mod_lua to use LuaJIT, instead of just plain Lua?

frooyo
  • 1,863
  • 3
  • 19
  • 21

1 Answers1

3

I was able to compile Apache 2.3 and link mod_lua against LuaJIT 2.0b6 like this:

LUA_LIBS="-L/usr/local/lib -lluajit-51 -lm" \
LUA_CFLAGS="-I/usr/local/include/luajit-2.0" \
./configure --prefix=/usr/local \
    --enable-lua --with-lua=/dev/null --enable-luajit
make

As far as I can tell, even though there's an --enable-luajit configuration flag, the mod_lua config.m4 script only looks for lua libraries by default.

If you built LuaJIT as a dynamic library as well as a static library, you may want to explicitly link it statically:

LUA_LIBS="/usr/local/lib/libluajit-5.1.a -lm"

(You may have to change the paths depending on which version of LuaJIT you have installed, and where. Caveat lector: I didn't actually install and test the results of this.)

Miles
  • 31,360
  • 7
  • 64
  • 74
  • Any idea how I'd deploy Super-NGINX on Debian? It's a script that has LuaJIT/NGINX already built --> https://github.com/ezmobius/super-nginx – frooyo Jun 06 '11 at 01:07