lunarmodules / luasocket

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

error compiling on windows 10 - mingw64 #394

Closed dwexel closed 11 months ago

dwexel commented 2 years ago

Hello, trying to install luasocket with luarocks install luasocket gives errors. I have both a 32-bit version and a 64-bit version of gcc, and interestingly, the 32-bit version successfully compiled luarocks install lpeg while the 64-bit version didn't. However, some people here seem to be using a 64-bit compiler with luarocks to install luasocket. Neither one works with installing luasocket, however. gcc version 6.3.0

Screenshot 2022-09-27 005438

Previously, I had issues trying to install rocks when luarocks would call "gcc" for some steps, and a different command, "mingw32-gcc" for another step, so I set the luarocks config to use "gcc" as the command for all the steps of the compiling process, and used the system PATH to point it to the 64-bit version or the 32-bit.

This method worked when installing lpeg, but not luasocket. Is this a problem with how I've set up luarocks? I'm not sure where to go from here. Thanks!

edit: this is the error when I use a 32-bit gcc:

Screenshot 2022-09-27 011947
dwexel commented 2 years ago

I found similar issues in the "closed issues" section. I will keep looking there, and update if I can fix it.

dwexel commented 2 years ago

Update: seemed to work after using downloading and using the 32-bit version of winlibs as per https://github.com/lunarmodules/luasocket/issues/337#issuecomment-1197562163

I didn't want to have to get into trying the whole visual studio thing!

hishamhm commented 1 year ago

I seem to have hit a similar error using mingw-w64 to cross-compile a Windows binary from a Linux host.

My solution was to download the rockspec locally and revert #383 manually (that is, to add the LUASOCKET_INET_PTON back to the mingw32 section by uncommenting line 37 from luarocks-3.1.0-1.rockspec).

LuaRocks currently (as of 3.9.1) does not support different platform entries for mingw32 and mingw64... I wonder if that's the proper solution. I'll run some local tests.

hishamhm commented 1 year ago

LuaRocks currently (as of 3.9.1) does not support different platform entries for mingw32 and mingw64...

Apparently this is not enough, because mingw32-w64 also has a i686 target ("the 32-bit version of the 64-bit fork of mingw32"... are you confused yet?). I'm starting to wonder if this is less about the architecture and more about the version of mingw...

alerque commented 11 months ago

Please don't post screen shots of terminal stuff, I can barely read this. Copy and paste please! It makes it both readable and searchable.

Also this seems to be a duplicate of #241 and possibly even fixed in the current release. Feel free to add more details to the original report if there are any.