Swift 6.0 dev snapshot on macOS 12: Symbol not found: (_$s10Foundation10NSNotFoundSivg)

Installing the latest 6.0 development snapshot and the Swift extension for VS Code, results in the following error:

dyld[11963]:
Symbol not found: (_$s10Foundation10NSNotFoundSivg)
Referenced from: '~/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-13-a.xctoolchain/usr/bin/swift-package'
Expected in: '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'

Is this expected to happen? Are there workarounds?

swift and swiftc both refer to the latest toolchain: swift --version outputs

Apple Swift version 6.0-dev (LLVM 3751470251df3e4, Swift 026ffddec66fd08)
Target: x86_64-apple-macosx12.0

What version of Xcode are you using?

The latest available on macOS 12, Xcode 14.2 (14C18).

The last time I checked the v6 swift nightlies on macOS require a beta version of Xcode as well as they get their SDKs from the Xcode installation.

This isn’t an SDK problem; this sounds like a deployment target problem. NSNotFound-as-defined-in-Swift wasn’t in Foundation in macOS 12; it was (I think) in the separate libswiftFoundation overlay dylib. So whoever compiled swift-package should have set the minimum deployment target to, uh, whatever the minimum is supposed to be.

(Or maybe they did do that. Apple doesn’t usually support more than one OS version back for its Xcodes, maybe the prebuilt Swift toolchains are the same.)

If you want to use Swift 6 you are probably best doing it inside a DevContainer vscode-swift/docs/remote-dev.md at main · swiftlang/vscode-swift · GitHub. You'll never get Swift 6 macOS to work with macOS 12.

1 Like