lunarmodules / luasocket

Network support for the Lua language
http://lunarmodules.github.io/luasocket/
MIT License
1.83k stars 626 forks source link

luasocket ERROR_NOT_ENOUGH_MEMORY declaration #241

Open pincooo opened 6 years ago

pincooo commented 6 years ago

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?

thank you for all,

Pincoo

ThomasJanuary88 commented 6 years ago

Any solution ? I had the same issue.

azrafe7 commented 6 years ago

I had the same problem.

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

See this for a similar issue (https://github.com/curl/curl/issues/2361).

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 :).

ThomasJanuary88 commented 6 years ago

It still doesn't work for me. Mingw64 doesn't have certain file as libgcc_s_dw2-1.dll which create system error !

pincooo commented 6 years ago

Many thanks azrafe7, your suggestion worked for me!

azrafe7 commented 6 years ago

@pincooo you're welcome.

@ThomasJanuary88, you're either still using mingw (the original), or have skipped some steps in the instructions for mingw-w64. That missing file makes me think that probably you've chosen dwarf as exception model, which also means that you've selected i686 as architecture.

What you need, according to the article, is x86_64 as architecture, and sj_lj for exception model. You can try reinstalling with that.

ewestbrook commented 5 years ago

Thanks for the mingw-w64 build tip!

We're reviewing open items in preparation for a release. If action is needed here, please add a comment. Otherwise, this issue will be closed on or after 24-Feb-2019.

Thanks!

ALENTL commented 2 years ago

Action needed pls help

alerque commented 10 months ago

Is this an issue in the current release?