Bug 52252 - luajit support broken for (at least) luajit 2.0
Summary: luajit support broken for (at least) luajit 2.0
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_lua (show other bugs)
Version: 2.4-HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2011-11-27 19:44 UTC by Stefan Fritsch
Modified: 2013-12-05 08:14 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Fritsch 2011-11-27 19:44:08 UTC
luajit 2.0 uses headers and library with different names than normal lua. For example on Debian, headers are in /usr/include/luajit-2.0/ and the library is called libluajit-5.1.so.2.

The library/header detection code of mod_lua does not have a special case for luajit at all and does not look for the pathnames of luajit.

Also, if I fix the linking, httpd aborts with this message:

[Sun Nov 27 20:37:19.619445 2011] [lua:debug] [pid 22767] mod_lua.c(206): [client] request details scope:0, filename:/home/stf/apache/perl-framework/t/htdocs/modules/lua/translate.lua, function:translate_name
PANIC: unprotected error in call to Lua API (attempt to index a string value)

Commenting out the calls to luaopen_jit and loadjitmodule in lua_vmprep.c "fixes" this insofar as t/modules/lua.t runs without error.

I don't have access to luajit 1.x, so I can't say if this is just an incompatibility with 2.0. But considering that the lua 5.1 manual says that "The luaopen_* functions (to open libraries) cannot be called directly, like a regular C function. They must be called through Lua, like a Lua function." [1], I think calling luaopen_jit is always wrong.

[1] http://www.lua.org/manual/5.1/manual.html#7.3
Comment 1 zhiguo zhao 2013-12-05 08:14:33 UTC
It also exist in 2.4.7,
./configure --prefix=/usr/local --enable-lua --enable-luajit --with-lua=/usr/local --enable-dbd
will generate this bugs,
./configure --prefix=/usr/local --enable-lua --with-lua=/usr/local --enable-dbd
 works ok