1

I installed the LuaRocks legacy package which includes Lua 5.1 on Windows. But when I run luarocks install luasocket, I get the following output:

Installing https://luarocks.org/luasocket-3.0rc1-2.src.rock

luasocket 3.0rc1-2 depends on lua >= 5.1 (5.1-1 provided by VM)
mingw32-gcc -O2 -c -o src/mime.o -IC:\Program Files (x86)\LuaRocks\include src/mime.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -shared -o mime/core.dll src/mime.o C:\Program Files (x86)\LuaRocks/lua5.1.dll -lMSVCR80
mingw32-gcc -O2 -c -o src/luasocket.o -IC:\Program Files (x86)\LuaRocks\include src/luasocket.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/timeout.o -IC:\Program Files (x86)\LuaRocks\include src/timeout.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/buffer.o -IC:\Program Files (x86)\LuaRocks\include src/buffer.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/io.o -IC:\Program Files (x86)\LuaRocks\include src/io.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/auxiliar.o -IC:\Program Files (x86)\LuaRocks\include src/auxiliar.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/options.o -IC:\Program Files (x86)\LuaRocks\include src/options.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/inet.o -IC:\Program Files (x86)\LuaRocks\include src/inet.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/except.o -IC:\Program Files (x86)\LuaRocks\include src/except.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/select.o -IC:\Program Files (x86)\LuaRocks\include src/select.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/tcp.o -IC:\Program Files (x86)\LuaRocks\include src/tcp.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/udp.o -IC:\Program Files (x86)\LuaRocks\include src/udp.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
mingw32-gcc -O2 -c -o src/wsocket.o -IC:\Program Files (x86)\LuaRocks\include src/wsocket.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) -Ic:/mingw/include
In file included from src/wsocket.h:11:0,
                 from src/socket.h:18,
                 from src/wsocket.c:10:
src/wsocket.c: In function 'socket_gaistrerror':
src/wsocket.c:417:14: error: 'ERROR_NOT_ENOUGH_MEMORY' undeclared (first use in this function)
         case EAI_MEMORY: return "memory allocation failure";
              ^
src/wsocket.c:417:14: note: each undeclared identifier is reported only once for each function it appears in

Error: Build error: Failed compiling object src/wsocket.o

What should I do install LuaSocket?

Anon
  • 116
  • 2
  • 6
  • `-IC:\Program Files (x86)\LuaRocks\include` should be `-I"C:\Program Files (x86)\LuaRocks\include"` instead – Egor Skriptunoff May 21 '21 at 22:37
  • @EgorSkriptunoff I have `C:\Program Files (x86)\LuaRocks` in my path, what should I change - can you please tell? – Anon May 22 '21 at 04:10
  • @EgorSkriptunoff It compiles succesfully for me on MinGW 4.8.1 where it has the same weird `-IC:\Program Files (x86)\LuaRocks\include` format https://gist.github.com/Ketho/68a26dc4fcb438b928c5a4b1aa36aa45 – Ketho Jul 14 '21 at 19:44
  • @Ketho - There are no paths containing spaces in your log. – Egor Skriptunoff Jul 14 '21 at 21:05
  • @EgorSkriptunoff It works for me with MinGW 4.8.1 even with a path containing spaces https://gist.github.com/Ketho/94673506f888ae358ce42a28c4c24157 – Ketho Jul 15 '21 at 14:12

1 Answers1

1

There is a ticket for this where they suggest using Mingw-w64 and x86_64 as architecture, and sj_lj for exception model. But it does not appear to be resolved. https://github.com/diegonehab/luasocket/issues/241

Ketho
  • 508
  • 3
  • 11