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

unable to install lua-http #223

Closed elhackeado closed 1 month ago

elhackeado commented 1 month ago

I am trying to install lua-http library using luarocks install http and getting some m4 error. I am using Apple Silicon M2 Pro. I was able to reproduce this issue on multiple Apple Silicon systems. I seems like one of the cqueues dependency have some issue with m4. Here's the full error log for luarocks install http

$ luarocks install http
Installing https://luarocks.org/http-0.4-0.all.rock
Missing dependencies for http 0.4-0:
   cqueues >= 20161214 (not installed)

http 0.4-0 depends on lua >= 5.1 (5.4-1 provided by VM: success)
http 0.4-0 depends on compat53 >= 0.3 (0.12-1 installed: success)
http 0.4-0 depends on bit32 (5.3.5.1-1 installed: success)
http 0.4-0 depends on cqueues >= 20161214 (not installed)
Installing https://luarocks.org/cqueues-20200726.54-0.src.rock

cqueues 20200726.54-0 depends on lua 5.4 (5.4-1 provided by VM: success)
Warning: unmatched variable LUA_LIBDIR
enabling Lua 5.1
enabling Lua 5.4
cp /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/config.h.guess /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/config.h
cp /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/config.h /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/config.h
mkdir -p /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/5.4
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused -Wno-dollar-in-identifier-extension -Wno-deprecated-declarations -O2 -fPIC -DLUA_COMPAT_APIINTCASTS -I/opt/homebrew/opt/lua/include/lua5.4 -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/opt/homebrew/include" -I"/opt/homebrew/include" -DCOMPAT53_PREFIX=cqueues -DCQUEUES_VENDOR='"quae@daurnimator.com"' -DCQUEUES_VERSION=20200726L  -c -o /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/5.4/cqueues.o /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/cqueues.c
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/cqueues.c:813:1: warning: unused parameter 'status' [-Wunused-parameter]
LUA_KFUNCTION(auxlib_tostringk) {
^
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/../vendor/compat53/c-api/compat-5.3.h:414:40: note: expanded from macro 'LUA_KFUNCTION'
  static int (_name)(lua_State *L, int status, lua_KContext ctx)
                                       ^
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/cqueues.c:813:1: warning: unused parameter 'ctx' [-Wunused-parameter]
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/../vendor/compat53/c-api/compat-5.3.h:414:61: note: expanded from macro 'LUA_KFUNCTION'
  static int (_name)(lua_State *L, int status, lua_KContext ctx)
                                                            ^
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/cqueues.c:2210:1: warning: unused parameter 'status' [-Wunused-parameter]
LUA_KFUNCTION(cqueue_step_cont) {
^
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/../vendor/compat53/c-api/compat-5.3.h:414:40: note: expanded from macro 'LUA_KFUNCTION'
  static int (_name)(lua_State *L, int status, lua_KContext ctx)
                                       ^
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/cqueues.c:2210:1: warning: unused parameter 'ctx' [-Wunused-parameter]
/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/../vendor/compat53/c-api/compat-5.3.h:414:61: note: expanded from macro 'LUA_KFUNCTION'
  static int (_name)(lua_State *L, int status, lua_KContext ctx)
                                                            ^
4 warnings generated.
mkdir -p /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/5.4
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused -Wno-dollar-in-identifier-extension -Wno-deprecated-declarations -O2 -fPIC -DLUA_COMPAT_APIINTCASTS -I/opt/homebrew/opt/lua/include/lua5.4 -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/opt/homebrew/include" -I"/opt/homebrew/include" -DCOMPAT53_PREFIX=cqueues -DCQUEUES_VENDOR='"quae@daurnimator.com"' -DCQUEUES_VERSION=20200726L  -c -o /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/5.4/socket.o /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/socket.c
cd /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src && m4 /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/errno.c.m4 >| /private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/errno.c.tmp
xcode-select: Failed to locate 'm4', requesting installation of command line developer tools.
make: *** [/private/var/folders/_d/023x9tls6p1ddm0n33m6ttgw0000gp/T/luarocks_cqueues-20200726.54-0-915726/cqueues-rel-20200726/src/errno.c] Error 72

Error: Failed installing dependency: https://luarocks.org/cqueues-20200726.54-0.src.rock - Build error: Failed building.
elhackeado commented 1 month ago

I was able to resolve the issue. It seems you have to explicitly install the m4 using brew install m4 and set m4 in your PATH echo 'export PATH="/opt/homebrew/opt/m4/bin:$PATH"' >> ~/.zshrc. Restart the terminal and then try running luarocks install http again. This should resolve the issue.

daurnimator commented 1 month ago

I was able to resolve the issue. It seems you have to explicitly install the m4 using brew install m4 and set m4 in your PATH echo 'export PATH="/opt/homebrew/opt/m4/bin:$PATH"' >> ~/.zshrc.

Is there no m4 in /opt/homebrew/bin?

In any case, this is not a lua-http issue: it's a cqueues installation issue caused by either a brew misconfiguration or brew bug.