Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting types for inet_ntop #298

Closed
aryajur opened this issue Mar 27, 2020 · 7 comments
Closed

Conflicting types for inet_ntop #298

aryajur opened this issue Mar 27, 2020 · 7 comments

Comments

@aryajur
Copy link

aryajur commented Mar 27, 2020

I am trying to compile luasocket with Msys2 mingw32. When I run make I get this error message:

src\inet.h:48:13: error: conflicting types for 'inet_ntop'
48 | 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:20:
C:/msys64/mingw32/i686-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);

ws2tcpip is included in inet.h file.

If I remove the compile option LUASOCKET_INET_PTON then it compiles fine.

@ewestbrook
Copy link
Contributor

If I remove the compile option LUASOCKET_INET_PTON then it compiles fine.

I see in src/makefile that this flag is added specifically for mingw builds. So, presumably, at some point it was required for most (if not all) installations of mingw. Can you help us determine for which targets it might no longer be appropriate?

I'd be inclined to remove it if your situation is the common mingw case now. That would fix it for the current users, while letting others add -DLUASOCKET_INET_PTON at the command line if needed.

Thoughts invited.

@aryajur
Copy link
Author

aryajur commented Mar 27, 2020

I have been compiling luasocket from the repository for a few years now. It used to work with that option before but now I tried after a few months I suppose and I started getting this error.

Both functions defined in the #ifdef LUASOCKET_INET_PTON - inet_ntop and inet_pton seem to be already present in the ws2tcpip.h file in mingw. Also in the microsoft documentation https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-inet_pton it seems they are defined there properly. So I think removing it seems reasonable.

@ewestbrook
Copy link
Contributor

ewestbrook commented Mar 28, 2020

Removal proposed in #300

@diegonehab
Copy link
Contributor

See discussion here for why this was introduced:

#39

Turns out these functions were only introduced in Vista and Win2k8. God knows if anybody still uses anything older than that.

@ewestbrook
Copy link
Contributor

Interesting! Isn't that all the more reason to remove it for the default case now, while still allowing those needing it to add -DLUASOCKET_INET_PTON?

@diegonehab
Copy link
Contributor

Indeed!

@ewestbrook
Copy link
Contributor

Closing now that #300 has been merged with the discussed change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants