Browse Source

Fix build when using static Linux SDK (#80)

This fixes a build issue when using the static Linux SDK. We were
branching on `#if os(Linux)` to decide whether a value we are using is
an enum or a statically defined integer: Glibc declares it as an enum,
whereas Darwin and Musl define it as an integer. We should make sure we
are importing Glibc and not Musl when we consider it an enum, as
otherwise the build will fail.
Gus Cairo 10 months ago
parent
commit
dac5f358f2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Sources/GRPCNIOTransportCore/Client/Resolver/DNSResolver.swift

+ 1 - 1
Sources/GRPCNIOTransportCore/Client/Resolver/DNSResolver.swift

@@ -61,7 +61,7 @@ package enum DNSResolver {
     }
 
     var hints = addrinfo()
-    #if os(Linux)
+    #if os(Linux) && canImport(Glibc)
     hints.ai_socktype = CInt(SOCK_STREAM.rawValue)
     #else
     hints.ai_socktype = SOCK_STREAM