daurnimator / lua-http

HTTP Library for Lua. Supports HTTP(S) 1.0, 1.1 and 2.0; client and server.
https://daurnimator.github.io/lua-http/
MIT License
778 stars 80 forks source link

lua http installation failing with lua 5.3 #187

Closed atibdialpad closed 3 years ago

atibdialpad commented 3 years ago

This is probably not a bug/ some mistake on my side, still reporting if someone can clarify Steps :

  1. Install lua 5.3 : apt-get install lua5.3

  2. Install luarocks : apt-get install luarocks

  3. Install lua-http FAILS `luarocks install http Installing https://luarocks.org/http-0.4-0.all.rock Missing dependencies for http 0.4-0: compat53 >= 0.3 (not installed) cqueues >= 20161214 (not installed) luaossl >= 20161208 (not installed) basexx >= 0.2.0 (not installed) lpeg (not installed) lpeg_patterns >= 0.5 (not installed) binaryheap >= 0.3 (not installed) fifo (not installed) http 0.4-0 depends on compat53 >= 0.3 (not installed) Installing https://luarocks.org/compat53-0.8-1.src.rock gcc -O2 -fPIC -I/usr/include/lua5.3 -c lutf8lib.c -o lutf8lib.o In file included from lprefix.h:46, from lutf8lib.c:10: c-api/compat-5.3.h:10:10: fatal error: lua.h: No such file or directory

    include

      ^~~~~~~

    compilation terminated. Error: Failed installing dependency: https://luarocks.org/compat53-0.8-1.src.rock - Build error: Failed compiling object lutf8lib.o `

  4. Install Lua 5.1

  5. Install lua http SUCCEEDS though I get some WARNINGS Warning: /usr/local/lib/lua/5.1/compat53/table.so is not tracked by this installation of LuaRocks. Moving it to /usr/local/lib/lua/5.1/compat53/table.so~ Warning: /usr/local/lib/lua/5.1/compat53/string.so is not tracked by this installation of LuaRocks. Moving it to /usr/local/lib/lua/5.1/compat53/string.so~ Warning: /usr/local/lib/lua/5.1/compat53/utf8.so is not tracked by this installation of LuaRocks. Moving it to /usr/local/lib/lua/5.1/compat53/utf8.so~

  6. My example http_lua code works lua lua_http.lua :status 200 date Mon, 26 Apr 2021 15:14:26 GMT content-type application/json content-length 233 connection keep-alive server gunicorn/19.9.0 access-control-allow-origin * access-control-allow-credentials true { "args": {}, "headers": { "Host": "httpbin.org", "User-Agent": "lua-http/0.4", "X-Amzn-Trace-Id": "Root=1-6086d8d2-0807e50f0cf27c5d3f1c393b" }, "origin": "103.35.127.33", "url": "http://httpbin.org/get" }

atibdialpad commented 3 years ago

@daurnimator any ideas/suggestions what might be going wrong here ?

RussellHaley commented 3 years ago

Hi,

I think you need to install liblua5.3-dev to get the header files. sudo apt install liblua5.3-dev.

The reason it works for Lua5.1 is because the LuaRocks installation pull in liblua5.1-dev files.

daurnimator commented 3 years ago

@atibdialpad as Russell notes; you need lua headers installed. on debian based distros you can usually find them in the liblua5.x-dev package for your lua version.