Skip to content

project depends on swift-nio build failed #2018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yh0xa55a8 opened this issue Dec 22, 2021 · 4 comments
Closed

project depends on swift-nio build failed #2018

yh0xa55a8 opened this issue Dec 22, 2021 · 4 comments

Comments

@yh0xa55a8
Copy link

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

@yh0xa55a8
Copy link
Author

It seems related to some code about new concurrency feature in swift 5.5, could it may caused by a compiler version issue or environment problem?

@yh0xa55a8
Copy link
Author

I tried to chage the version of swift-nio and found that Only v2.36.0 has this issue.
I guess it may related to #2004.

@0xTim
Copy link
Contributor

0xTim commented Dec 22, 2021

This will be fixed by #2015. The workaround for now is to update to Xcode 13.1/13.2

@Lukasa
Copy link
Contributor

Lukasa commented Jan 4, 2022

Fixed by #2015.

@Lukasa Lukasa closed this as completed Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants