Trouble cross compiling with Swift 6.0

Hi,

I was trying to cross compile a web server based on SwiftNIO. I get the following error when trying to cross compile SwiftNIO by it's self. I have downloaded the command line tools update released today and restarted my computer after. Any suggestions how to update Dispatch?

swift build -c release --swift-sdk x86_64-swift-linux-musl
swift build --swift-sdk x86_64-swift-linux-musl

swift-nio/Sources/NIOCore/ByteBuffer-aux.swift:15:8: error: compiled module was created by a different version of the compiler ''; rebuild 'Dispatch' and try again: /Users/zane/Library/org.swift.swiftpm/swift-sdks/swift-6.0-RELEASE_static-linux-0.0.1.artifactbundle/swift-6.0-RELEASE_static-linux-0.0.1/swift-linux-musl/musl-1.2.5.sdk/x86_64/usr/lib/swift_static/linux-static/x86_64/Dispatch.swiftmodule

MacOS 15.0 (24A335)
sdk checksum:
7984c2cf175bde52ba6ea1fcbe27fc4a148a6237c41c719209c9288ed3ceb652
swift:
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2) Target: arm64-apple-macosx15.0

Thanks,
Zane

Update, having the same issue on different Mac. Can't seem to build the hello world example listed either.

test swift build --swift-sdk x86_64-swift-linux-musl
Building for debugging...
<unknown>:0: warning: libc not found for 'x86_64-swift-linux-musl'; C stdlib may be unavailable
<unknown>:0: warning: libc not found for 'x86_64-swift-linux-musl'; C stdlib may be unavailable
error: unableToFind(tool: "swift-autolink-extract")

I'm kinda new at this should this have been filed as an issue instead?

Thanks,
Zane

It looks like there's something seriously wrong with your install, if it cannot even find the C stdlib. Try removing any SDKs you have installed and just reinstalling the latest 6.0 SDK. If that still doesn't work, add the -v flag and copy-paste the full verbose output here.

Actually, Swift SDK for Static Linux cannot be used with Xcode toolchain. You need to install an Open Source toolchain from swift.org. Could you install Swift 6.0 OSS toolchain by following Swift.org - macOS Package Installer and try again?

1 Like

Yep, that was the problem. I assumed they were roughly the same and glossed over that step. Still a crash when compiling NIO but I will submit that stack trace as an issue.

Thank you so much, I appreciate the help.