integrating lua module with nginx

142 views
Skip to first unread message

Pradeep L

unread,
Jan 26, 2015, 2:19:56 PM1/26/15
to openre...@googlegroups.com
Hi all,
       My friend built the nginx by adding  lua module into it but while building nginx he did not specifie the path of luaJIT (LUAJIT_LIB and LUAJIT_INC ). he has given me the nginx rpm  . i tried to  install this rpm  on my machine but i got dependency error  " libluajit-5.1.so.2 not found ..".
then i populated the environment variables LUAJIT_LIB and LUAJIT_INC  on my machine and tried to install the rpm still i am getting the same dependency error .

my queries..
Is it necessary to specify the path of luaJIT while building the nginx with lua module  ? 
Cant we specify the path of luaJIT after building the nginx with lua module ?
How can i specify the luaJIT path to this rpm ?

i am newbie to nginx and lua so in need of your help .

Thanks
Pradeep

Yichun Zhang (agentzh)

unread,
Jan 26, 2015, 6:40:12 PM1/26/15
to openresty-en
Hello!

On Mon, Jan 26, 2015 at 11:19 AM, Pradeep L wrote:
> i tried to install this rpm
> on my machine but i got dependency error " libluajit-5.1.so.2 not found
> ..".
> then i populated the environment variables LUAJIT_LIB and LUAJIT_INC on my
> machine and tried to install the rpm still i am getting the same dependency
> error .
>

You need to specify the following option for your ./configure command
while building nginx:

--with-ld-opt='-Wl,-rpath,/path/to/luajit/lib"

such that the LuaJIT path is added to your nginx executable's RPATH
header and the user does not have to specify the LD_LIBRARY_PATH
environment himself.

> my queries..
> Is it necessary to specify the path of luaJIT while building the nginx with
> lua module ?

Not necessary, but good to have. You can always specify
LD_LIBRARY_PATH at the runtime to change the LuaJIT library to use
without rebuilding nginx. But adding the RPATH to the nginx executable
is more handy when you don't want the capability to change the luajit
library easily at runtime (usually you don't).

> Cant we specify the path of luaJIT after building the nginx with lua module
> ?

Yes, by the LD_LIBRARY_PATH environment, for example:

export LD_LIBRARY_PATH=/path/to/your/luajit/lib:$LD_LIBRARY_PATH

You need to set it before starting nginx.

> How can i specify the luaJIT path to this rpm ?
>

Usually we specify RPATH in the executable for nonstandard locations
of the dependent libraries.

> i am newbie to nginx and lua so in need of your help .
>

It's *highly* recommended to use the OpenResty bundle to avoid such
troubles (and more down the road):

http://openresty.org/#Download

OpenResty takes care of RPATH and all other similar (and more
important) details automatically for you.

Regards,
-agentzh
Reply all
Reply to author
Forward
0 new messages