swiftwasm / swift

WebAssembly support for the Swift programming language
https://swiftwasm.org
1.28k stars 28 forks source link

Unable to use newer Xcode than SwiftWasm toolchain's Swift version #5550

Closed turbolent closed 5 months ago

turbolent commented 9 months ago

After installing the 5.8 toolchain in Xcode 15, I get the following error:

Unable to discover `swiftc` command line tool info: Could not parse Swift versions from: SwiftWasm Swift version 5.8 (swiftlang-5.8.0)
kateinoigakukun commented 7 months ago

This is very FAQ, so let me explain here for record.

There are several error caused by newer Xcode and older SwiftWasm toolchain combination.

  1. Dispatch module references too new declarations while building for host target.

    /Applications/Xcode-15beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/swift/Dispatch.swiftmodule/arm64e-apple-macos.swiftinterface:702:121: error: no type named '__DispatchData' in module 'Dispatch'

    This usually happens while building Package.swift containing import Foundation by swift build.

  2. Unable to discoverswiftccommand line tool info while building in Xcode But actually building with SwiftWasm toolchain in Xcode is not supported at this time, so it won't work even though using the same Swift versions with Xcode and SwiftWasm toolchain.

So at this time, SwiftWasm toolchain is only usable with Xcodes corresponding the same Swift version. We are transiting to Swift SDK instead of xctoolchain and it will solve the root issue.

kateinoigakukun commented 5 months ago

A new version of SwiftWasm toolchain has been released https://github.com/swiftwasm/swift/releases/tag/swift-wasm-5.9.1-RELEASE

The new toolchain works with Xcode 15.x