Search code examples
windowsgcclualuarocksluasocket

Not able to install LuaSocket from LuaRocks on Windows


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?


Solution

  • 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