Skip to content

Commit 21929be

Browse files
authored
Fix FILEPointer typealias for Musl (#491)
Currently, `FILEPointer` is typealiased to `OpaquePointer` for Musl: ```swift #if os(Android) || canImport(Musl) public typealias FILEPointer = OpaquePointer #else public typealias FILEPointer = UnsafeMutablePointer<FILE> #endif ``` But building an executable that links against TSCBasic fails: ``` $ ~/Library/Developer/Toolchains/swift-6.0.1-RELEASE.xctoolchain/usr/bin/swift build --swift-sdk x86_64-swift-linux-musl .build/checkouts/swift-tools-support-core/Sources/TSCBasic/Process/Process.swift:706:70: error: cannot convert value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>') to expected argument type 'FILEPointer' (aka 'OpaquePointer') 704 | throw Process.Error.stdinUnavailable 705 | } 706 | let stdinStream = try LocalFileOutputByteStream(filePointer: fp, closeOnDeinit: true) | `- error: cannot convert value of type 'UnsafeMutablePointer<FILE>' (aka 'UnsafeMutablePointer<_IO_FILE>') to expected argument type 'FILEPointer' (aka 'OpaquePointer') ``` But removing the `canImport(Musl)` check allows it to compile without issue, so I assume it was put there for an earlier version of the Musl SDK (or that it was never tested).
1 parent 5b130e0 commit 21929be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/TSCBasic/WritableByteStream.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public extension WritableByteStream {
6666
// Public alias to the old name to not introduce API compatibility.
6767
public typealias OutputByteStream = WritableByteStream
6868

69-
#if os(Android) || canImport(Musl)
69+
#if os(Android)
7070
public typealias FILEPointer = OpaquePointer
7171
#else
7272
public typealias FILEPointer = UnsafeMutablePointer<FILE>

0 commit comments

Comments
 (0)