Linux Static SDK with 5.10.1? Or only v6?

Hey all,

I'm really new to swift. Started with it after seeing the wwdc videos.

I already developed a small software with it and it's really a great and "easy" language.

I tried to use Swift.org - Getting Started with the Static Linux SDK with 5.10.1, but it seems that swift sdk is only available in v6. And swift experimental-sdk won't work. With v6 the build is working, but swift-nio's FileSystem.shared.info causes a crash.

Is the linux static sdk only working with v6? Or should it work with v5.10.1?

# swift 5.10.1
swift experimental-sdk install https://download.swift.org/development/static-sdk/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1.artifactbundle.tar.gz
Downloading a Swift SDK bundle archive from `https://download.swift.org/development/static-sdk/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1.artifactbundle.tar.gz`...
Swift SDK bundle archive successfully downloaded from `https://download.swift.org/development/static-sdk/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1.artifactbundle.tar.gz`.
Swift SDK bundle at `https://download.swift.org/development/static-sdk/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1.artifactbundle.tar.gz` is assumed to be an archive, unpacking...
Error: failed parsing ArtifactsArchive info.json at '/var/folders/38/vm_vz0h56_n3_747qbx0772r0000gn/T/TemporaryDirectory.mWmOVK/extraction-results/swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1.artifactbundle/info.json': keyNotFound(CodingKeys(stringValue: "supportedTriples", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "artifacts", intValue: nil), _JSONKey(stringValue: "swift-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1", intValue: nil), CodingKeys(stringValue: "variants", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: \"supportedTriples\", intValue: nil) (\"supportedTriples\").", underlyingError: nil))

Best regards,
Patrick

1 Like

I believe only trunk 6.1 snapshots are supported right now, as the scripts used to generate that Musl SDK are publicly available. You are trying to use a Swift 6.1 Musl SDK with the Swift 5.10.1 compiler, which is never going to work, as the 5.10 compiler is not forward-compatible with 6.1 SDKs.

If you download the latest trunk 6.1 snapshot build of the Swift toolchain and matching Musl SDK for that tag, it should work. I've just been building some full Swift packages like swift-crypto/nio on Fedora Core 40 using this new Musl SDK without a problem.

Alternately, you could try using those SDK scripts to generate a 5.10.1 Musl SDK yourself, then use that.

2 Likes

An update: @al45tair, who put together the Musl SDK, informs me that a 6.0 SDK does exist and he doesn't plan to ship a 5.10 Musl SDK. I downloaded the June 8 Musl SDK for Swift 6.0 after he wrote that and verified that it does work well with the most recent 6.0 snapshot toolchain.

Also, it looks like several of his Musl pulls were merged this year, after 5.10 branched last year, and were not backported, so using Musl with 5.10 would require integrating those first.

3 Likes

I just tried the Static Linux SDK today with Swift 6.0 and it works (see this enhancement request).

If you run into a segmentation fault on macOS Sonoma, check this workaround.

4 Likes