Skip to content

project depends on swift-nio build failed #2018

Closed
@yh0xa55a8

Description

@yh0xa55a8

Actual behavior

swift-nio build failed.

Steps to reproduce

  1. Create a swift project from xcode using swift package manager.
  2. Add swiftNIO to dependency.
  3. Build the project, got a compiler error:
<HOME>/Library/Developer/Xcode/DerivedData/test-beeqcutotskvvwafknwhdzcnlayo/SourcePackages/checkouts/swift-nio/Sources/NIOCore/AsyncAwaitSupport+OldXcodes.swift:66:91: error: cannot find type 'Task' in scope
    public func completeWithTask(_ body: @escaping @Sendable () async throws -> Value) -> Task<Void, Never> {
                                                                                          ^~~~
<HOME>/Library/Developer/Xcode/DerivedData/test-beeqcutotskvvwafknwhdzcnlayo/SourcePackages/checkouts/swift-nio/Sources/NIOCore/AsyncAwaitSupport+OldXcodes.swift:25:26: error: cannot find 'withUnsafeThrowingContinuation' in scope
        return try await withUnsafeThrowingContinuation { cont in
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<HOME>/Library/Developer/Xcode/DerivedData/test-beeqcutotskvvwafknwhdzcnlayo/SourcePackages/checkouts/swift-nio/Sources/NIOCore/AsyncAwaitSupport+OldXcodes.swift:43:26: error: cannot find 'withCheckedThrowingContinuation' in scope
        return try await withCheckedThrowingContinuation { cont in
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Build failed    2021/12/22, 8:20 PM    0.6 seconds

A minimum Package.swift File is as follows:

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "test",
    
    dependencies: [
        .package(url: "https://github.com/apple/swift-nio.git", from: "2.33.0")
    ],
    targets: [
        .target(
            name: "App",
            dependencies: [
                .product(name: "NIO", package: "swift-nio"),
            ]
        ),
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
        .executableTarget(name: "Run", dependencies: [.target(name: "App")])
    ]
)

I use

SwiftNIO version/commit hash

2.36.0

System & version information

Xcode 13.0 (13A233)
swift compiler version: swift-driver version: 1.26.9 Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)
Target: x86_64-apple-macosx12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions