luasocket
luasocket copied to clipboard
Remove LUASOCKET_INET_PTON from *.rockspec
Recent MinGW provides inet_pton(). There is our inet_pton() implementation in src/inet.c. Our inet_pton() is declared in src/inet.h but the declaration causes the following build error:
gcc -O2 -fPIC -c -o src/luasocket.o -IC://msys64/mingw64/include/luajit-2.0 src/luasocket.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_INET_PTON -DWINVER=0x0501 -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
src/inet.h:46:13: error: conflicting types for 'inet_ntop'
46 | const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
| ^~~~~~~~~
In file included from src/wsocket.h:12,
from src/socket.h:18,
from src/inet.h:18,
from src/luasocket.c:30:
C:/msys64/mingw64/x86_64-w64-mingw32/include/ws2tcpip.h:451:35: note: previous declaration of 'inet_ntop' was
here
451 | WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, LPCVOID pAddr, LPSTR pStringBuf, size_t StringBufSize);
| ^~~~~~~~~
In file included from src/luasocket.c:30:
src/inet.h:47:5: warning: 'inet_pton' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
47 | int inet_pton(int af, const char *src, void *dst);
| ^~~~~~~~~
We already know that we don't need our inet_pton() for recent MinGW. 78a1657c7db5510ba66f8d4491f1e8e7370c5943 (#300) removed -DLUASOCKET_INET_PTON but LUASOCKET_INET_PTON in *.rockspec wasn't removed.
It causes "luarocks install luasocket" for MinGW causes the above build error.
See also #298 and #300.
As mentioned in the linked issues, we are looking for a solution that helps users of newer MinGW while continuing to work (conditionally) for users with older MinGW versions.
OK. How about 3b7b079 ?
We can detect whether our inet_pton()
is needed or not by checking InetPtonA
.
I can't test this on Windows XP but it'll work.
@ewestbrook Could you review again?
Thanks for approving this! What should we do to merge this into the master?
Calling @diegonehab to the white courtesy telephone, please
My question is this: MinGW is a way to compile stuff for Windows. It is supposed to be compatible with, or to replace Visual Studio. Somehow they added this incompatibility. What I want to avoid is to fix MinGW in a way that breaks Visual Studio. Does that make sense? Visual Studio is also free. Can somebody verify this?
How about adding CI jobs for MinGW and Visual Studio? If it makes sense, I'll create a separated pull request for it.
This would be great. Can we integrate VS with github CI?
Yes.
GitHub Actions provides Visual Studio 2019 on windows-2019
image https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019 and Visual Studio 2017 on windows-2016
image
https://github.com/actions/virtual-environments/blob/main/images/win/Windows2016-Readme.md#visual-studio-enterprise-2017
.
I'll work on it.
@diegonehab Could you confirm #315?
I'll rebase this on master once #315 is merged.
It seems that #383 fixed this. I close this.
Thanks for the feedback on where your PRs were at. Sorry your contributions didn't get recognized because some work got duplicated in the shuffle. If there are any more issues / PRs that you happen to know the status of or can test (especially Windows related stuff that I'm not in a position to test) I'd be happy to see cleanup keep moving forward.
No problem! I don't have any more issues/PRs.