Closed bscottm closed 5 years ago
rpcapd
compile breaks with an undefined reference toinet_ntop
. The cause is the MinGW 8.x series gcc and associated WinXX runtime support.
So the MinGW 8.x runtime support doesn't include inet_ntop()
, unlike the libraries shipped by Microsoft?
The workaround, if one calls it that, is to conditionally compile for
_WIN32
and usegetnameinfo
.
Presumably that's "getnameinfo()
with NI_NUMERICHOST
and NI_NUMERICSERV
set"?
Not sure if that's the preferred patch or if there's a different approach to fix.
rpcapd already uses getnameinfo()
, so we could just unconditionally use it for those error messages - call getnameinfo()
to convert both the address and the port to numeric strings (passing NI_NUMERICHOST| NI_NUMERICSERV
as the flags argument), and then log them.
So the MinGW 8.x runtime support doesn't include inet_ntop(), unlike the libraries shipped by Microsoft?
No reason to be snippy. It's an issue with MingGW's 8.x series; the 9.x gcc doesn't have the problem (but I'm not betting on a mass upgrade for scoop
users any time soon.) It's not as if there aren't differences between Linux distros lagging each other on kernel versions and unsupported ioctl
calls that cause similar portability issues.
Presumably that's "getnameinfo() with NI_NUMERICHOST and NI_NUMERICSERV set"?
Sure, if that makes the most sense.
rpcapd already uses getnameinfo(), so we could just unconditionally use it for those error messages - call getnameinfo() to convert both the address and the port to numeric strings (passing NI_NUMERICHOST| NI_NUMERICSERV as the flags argument), and then log them.
It's not as straightforward as just unconditionally using it for specific error messages, at least not when I looked at the code. I'll attempt a patch for a pull.
What is you just define _WIN32_WINNT >= 0x600
?
My old v4.0 TDM-MinGW gets you inet_ntop()
if you do that.
I could give that a shot. Not sure where I'd do that in CMakeLists.txt
.
I could give that a shot. Not sure where I'd do that in
CMakeLists.txt
.
Somewhere in the "Project settings" section. If it should be done only with MinGW, do it inside a test for MinGW:
if(MINGW)
# We want support for APIs that appeared in Windows Vista
add_definitions(-D _WIN32_WINNT=0x600)
endif(MINGW)
What is you just define
_WIN32_WINNT >= 0x600
? My old v4.0 TDM-MinGW gets youinet_ntop()
if you do that.
Done in ee7b04c4d30ba1afbd81debfc71899eb8a24d5ab.
And:
_WIN32_WINNT
as 0x600 means we get warnings about inet_ntop()
not being declared;so I'm closing this.
@guyharris: WFM.
@guyharris: WFM.
WFM2, as per builds on ci.appveyor.com.
rpcapd
compile breaks with an undefined reference toinet_ntop
. The cause is the MinGW 8.x series gcc and associated WinXX runtime support. The workaround, if one calls it that, is to conditionally compile for_WIN32
and usegetnameinfo
. Not sure if that's the preferred patch or if there's a different approach to fix.Note: This would afflict users who install the MinGW gcc compilers via
scoop
, which is still on the 8.x series. An updated MinGW 9.x series compiler doesn't have this issue. Nonetheless, things should just work out-of-the-box.