Skip to content

inet_pton and inet_ntop missing in MinGW64 Windows build of grpc 0.13.0 #6018

@emmenlau

Description

@emmenlau

During the compile of grpc 0.13.0 on Windows 7 with MinGW64 / MSYS2 (currently gcc 5.3.0), I get errors related to two functions, called inet_pton and inet_ntop. I found other people have these problems too, and use getnameinfo() on Windows as a replacement (see etr/libhttpserver#71)
First error:

[C]       Compiling src/core/client_config/resolvers/sockaddr_resolver.c
src/core/client_config/resolvers/sockaddr_resolver.c: In function 'parse_ipv4':
src/core/client_config/resolvers/sockaddr_resolver.c:223:7: error: implicit declaration of function 'inet_pton' [-Werror=implicit-function-declaration]
   if (inet_pton(AF_INET, host, &in->sin_addr) == 0) {
       ^
����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������```

Second error:

src/core/iomgr/sockaddr_utils.c: In function 'grpc_sockaddr_to_string':
src/core/iomgr/sockaddr_utils.c:163:7: error: implicit declaration of function 'inet_ntop' [-Werror=implicit-function-declaration]
       inet_ntop(addr->sa_family, (void *)ip, ntop_buf, sizeof(ntop_buf)) !=
       ^
src/core/iomgr/sockaddr_utils.c:163:74: error: comparison between pointer and integer [-Werror]
       inet_ntop(addr->sa_family, (void *)ip, ntop_buf, sizeof(ntop_buf)) !=

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions