You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Work around a type checking error when using the Static Linux SDK (#2898)
# Motivation
Building `swift-nio` with the Static Linux SDK
(https://www.swift.org/documentation/articles/static-linux-getting-started.html),
fails in `PosixSingletons+ConcurrencyTakeOver.swift`:
```
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/private/tmp/vaportest/.build/checkouts/swift-nio/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift:76:12: error: conflicting arguments to generic parameter 'T' ('Optional<UnsafeRawPointer>.AtomicRepresentation' vs. 'Optional<UnsafeRawPointer>.AtomicRepresentation')
74 | dlopen(nil, RTLD_NOW),
75 | "swift_task_enqueueGlobal_hook"
76 | )?.assumingMemoryBound(to: UnsafeRawPointer?.AtomicRepresentation.self)
| `- error: conflicting arguments to generic parameter 'T' ('Optional<UnsafeRawPointer>.AtomicRepresentation' vs. 'Optional<UnsafeRawPointer>.AtomicRepresentation')
77 | guard let concurrencyEnqueueGlobalHookPtr = concurrencyEnqueueGlobalHookPtr else {
78 | return false
```
This happens because `Foundation` and `swift-atomics` both define
`AtomicRepresentation`. A compiler problem (rdar://132885963) makes
these extensions globally visible, causing the two
`AtomicRepresentation`
types to collide. This only affects non-Darwin platforms.
# Modification
This PR works around the problem by using a local type alias which does
not collide with the other `AtomicRepresentation` types.
# Result
It is now possible to build `swift-nio` with the Static Linux SDK.
Fixes: #2893
Suggested-by: Alastair Houghton <[email protected]>
0 commit comments