Skip to content
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

Fails to compile Xcode 13 RC (note: needs macOS release) #110

Closed
joshuawright11 opened this issue Sep 16, 2021 · 14 comments
Closed

Fails to compile Xcode 13 RC (note: needs macOS release) #110

joshuawright11 opened this issue Sep 16, 2021 · 14 comments
Labels
discussion for things that need discussion

Comments

@joshuawright11
Copy link
Contributor

joshuawright11 commented Sep 16, 2021

Hey folks, trying to build with Xcode 13 RC.

Steps to reproduce

git clone https://github.com/swift-server/swift-service-lifecycle.git
cd swift-service-lifecycle
swift build

.../swift-service-lifecycle/Sources/Lifecycle/Lifecycle.swift:16:8: error: no such module '_Concurrency'
import _Concurrency

And swift --version is

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-macosx11.0

Assume the fix is just to delete the import _Concurrency? (didn't actually fix it, as discussed below)

@ktoso
Copy link
Contributor

ktoso commented Sep 17, 2021

Yeah, the import is not necessary anymore, do you want to send in a PR?

@ktoso
Copy link
Contributor

ktoso commented Sep 17, 2021

Ok sorry I know what's going on now.

This is a weird situation in time where the RC of Xcode assumes that concurrency is provided by the OS -- the Betas did not assume that but this RC does. But the OS with Concurrency has not been released yet, so you can't use the RC Xcode yet.

This will just work once the next macOS is released, it will have the next SDK with concurrency and things will just work.

@ktoso ktoso changed the title Fails to compile Xcode 13 RC Fails to compile Xcode 13 RC (note: needs macOS release) Sep 17, 2021
@ktoso ktoso added the discussion for things that need discussion label Sep 17, 2021
@joshuawright11
Copy link
Contributor Author

Gotcha, okay. How does that work on linux I wonder? Is concurrency provided on the linux swift toolchains when >=5.5?

@ktoso
Copy link
Contributor

ktoso commented Sep 17, 2021

On linux (on all non-apple platforms for that matter) everything is included in the toolchains yes.

@joshuawright11
Copy link
Contributor Author

👍 so just to be clear there is no way to use the new async await stuff with Xcode 13 RC until I've got macOS Monterey is installed?

(to use it I'd have to wait for Monterey to drop or use a prior Xcode 13 Beta)

@ktoso
Copy link
Contributor

ktoso commented Sep 18, 2021

That seems to be the case AFAICS

@joshuawright11
Copy link
Contributor Author

joshuawright11 commented Sep 21, 2021

Since the official Xcode 13 is out and this still seems to prevent compilation for macOS targets other than the unreleased Monterrey, would it make more sense to instead of using

#if compiler(>=5.5)

use this?

#if canImport(_Concurrency)

Since technically using concurrency is dependent on the availability of the concurrency library rather than swift 5.5? And even after Monterrey is released compilation would still fail on older macOS targets.

Perhaps it would also need to check for 5.5 as well;

#if compiler(>=5.5) && canImport(_Concurrency)

The only thing I'm wondering is if import _Concurrency is going to stick around in future versions of Swift, rather than just be included in the language.

Regardless; I've opened a PR #111, I'll close it if I'm misguided in my understanding here.

@adam-fowler
Copy link
Member

I've been able to get Xcode RC to work by installing the latest swift 5.5 nightly from swift.org.

@joshuawright11
Copy link
Contributor Author

joshuawright11 commented Sep 21, 2021

I assume that's because concurrency is included in the nightly toolchain? That would be great

@ktoso
Copy link
Contributor

ktoso commented Sep 21, 2021

Commented in the PR; long story short:

#if compiler(>=5.5) && canImport(_Concurrency)

is the right way to guard code using async/concurrency, but...

The only thing I'm wondering is if import _Concurrency is going to stick around in future versions of Swift, rather than just be included in the language.

I guess it'll stay but we should not "spell it out", it is imported automatically.

@joshuawright11
Copy link
Contributor Author

Great, all merged so this can be closed.

@adam-fowler curious, were you able to get concurrency working with that nightly as well? I downloaded the last swift 5.5 nightly and still get a "async requires macOS 12" error when adding an async function. No error if I'm on trunk development snapshot, but I'd prefer to use Swift 5.5 bundled with concurrency.

@adam-fowler
Copy link
Member

@joshuawright11 Yeah I've been running with RC for a while now with a swift 5.5 snapshot. Current one I am using 2021-09-15

@adam-fowler
Copy link
Member

@joshuawright11 You do get a weird thing where the IDE tells you it won't compile, but when you build it, it does compile. It is probably easier to stick with the beta 5

@joshuawright11
Copy link
Contributor Author

Ended up rolling with the latest nightly so I didn't need to sprinkle the @availables everywhere. Will wait to release until the concurrency back port work is widely available.

programmarchy added a commit to programmarchy/swift-aws-lambda-runtime that referenced this issue Oct 4, 2021
This allows Xcode 13 to still compile on macOS 11 which does not have symbols for Concurrency yet
See swift-server/swift-service-lifecycle#110
programmarchy added a commit to programmarchy/swift-aws-lambda-runtime that referenced this issue Oct 4, 2021
This allows Xcode 13 to still compile on macOS 11 which does not have symbols for Concurrency yet
See swift-server/swift-service-lifecycle#110
programmarchy added a commit to programmarchy/swift-aws-lambda-runtime that referenced this issue Oct 4, 2021
This allows Xcode 13 to still compile on macOS 11 which does not have symbols for Concurrency yet
See swift-server/swift-service-lifecycle#110
programmarchy added a commit to programmarchy/swift-aws-lambda-runtime that referenced this issue Oct 4, 2021
This allows Xcode 13 to still compile on macOS 11 which does not have symbols for Concurrency yet
See swift-server/swift-service-lifecycle#110
tomerd pushed a commit to swift-server/swift-aws-lambda-runtime that referenced this issue Oct 5, 2021
This allows Xcode 13 to still compile on macOS 11 which does not have symbols for Concurrency yet
See swift-server/swift-service-lifecycle#110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion for things that need discussion
Projects
None yet
Development

No branches or pull requests

3 participants