ledgetech / lua-resty-http

Lua HTTP client cosocket driver for OpenResty / ngx_lua.
BSD 2-Clause "Simplified" License
1.99k stars 626 forks source link

Issue in make file #14

Closed gsick closed 10 years ago

gsick commented 10 years ago

Hi,

When I'm trying to launch my lua file, LUA is not able to find http.lua:

lua: lib/openam/openam.lua:1: module 'resty.http' not found: no field package.preload['resty.http'] no file './resty/http.lua' no file '/usr/share/lua/5.1/resty/http.lua' no file '/usr/share/lua/5.1/resty/http/init.lua' no file '/usr/lib64/lua/5.1/resty/http.lua' no file '/usr/lib64/lua/5.1/resty/http/init.lua' no file './resty/http.so' no file '/usr/lib64/lua/5.1/resty/http.so' no file '/usr/lib64/lua/5.1/loadall.so' no file './resty.so' no file '/usr/lib64/lua/5.1/resty.so' no file '/usr/lib64/lua/5.1/loadall.so'

When I locate http.lua, the file is here: /usr/lib64/lua/5.1/resty/http/http.lua

What is wrong? the install path in Makefile or the require declaration?

$(DESTDIR)/$(LUA_LIB_DIR)/resty/http/ should be $(DESTDIR)/$(LUA_LIB_DIR)/resty/ ?

Thx

pintsized commented 10 years ago

Hi,

The make install task is just to be compatible with how the ngx_openresty build system works, if you happen to be building this yourself. Otherwise, really the Makefile is just for make test.

The thing you're probably missing is ensuring OpenResty can see your Lua modules. Everything in the standard distribution is already set in lua_package_path. So you can either manually install lua-resty-http next to the other Lua modules in your OpenResty installation (something like /usr/local/openresty/lualib/resty), or keep them elsewhere and ensure you add your paths to the lua_package_path nginx directive, for example:

http {
  lua_package_path "/path/to/lua-resty-http/lib/?.lua;;";

  server {
  ...
  }
}
gsick commented 10 years ago

ok thanks. I m not use openresty so i won t use this makefile.