Search code examples
lualuasocketluarocks

luasocket ERROR_NOT_ENOUGH_MEMORY declaration


In windows 7 with MinGW installed, I try to install luasocket on lua-5.3.4 environment with luarocks-2.4.3-win32 I give the shell command

c:\>luarocks install c:\luasocket-master\luasocket-scm-0.rockspec

OR

c:\>luarocks install luasocket

I always get the following error:

C:\luasocket-master>luarocks install c:\luasocket-master\luasocket-scm-0.rockspec
mingw32-gcc -O2 -c -o src/luasocket.o -IC:/Program Files (x86)/lua-5.3.4/include src/luasocket.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/timeout.o -IC:/Program Files (x86)/lua-5.3.4/include src/timeout.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/buffer.o -IC:/Program Files (x86)/lua-5.3.4/include src/buffer.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/io.o -IC:/Program Files (x86)/lua-5.3.4/include src/io.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/auxiliar.o -IC:/Program Files (x86)/lua-5.3.4/include src/auxiliar.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/options.o -IC:/Program Files (x86)/lua-5.3.4/include src/options.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/inet.o -IC:/Program Files (x86)/lua-5.3.4/include src/inet.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/except.o -IC:/Program Files (x86)/lua-5.3.4/include src/except.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/select.o -IC:/Program Files (x86)/lua-5.3.4/include src/select.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/tcp.o -IC:/Program Files (x86)/lua-5.3.4/include src/tcp.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/udp.o -IC:/Program Files (x86)/lua-5.3.4/include src/udp.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/compat.o -IC:/Program Files (x86)/lua-5.3.4/include src/compat.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mingw32-gcc -O2 -c -o src/wsocket.o -IC:/Program Files (x86)/lua-5.3.4/include src/wsocket.c -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
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 PIE_MEMORY;
              ^
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

I googled for this, but no way, I didn't find anything. It seems that the compiler didn't find some header, I checked all paths in environment variables and they are ok. Maybe some compatibility issue? Did anyone face this issue in past?

thank you for all,

Pietro


Solution

  • Solved by using mingw-w64 (and msys2) instead of mingw.

    And - more importantly - this (https://computingabdn.com/softech/mingw-howto-install-gcc-for-windows/) for detailed instructions on how to properly install both packages (using default config settings in the installer won't cut it :).