Static linking issue using Swift 6.4.0 on Linux

Hi everyone,

I’m seeing a static-linking failure on Linux when building soto-codegenerator 7.10.0 with Swift 6.4:

swift build -c release --static-swift-stdlib --manifest-cache local

The linker reports undefined references such as:

swift_uloc_minimizeSubtags
swift_unum_open
swift_ucal_open
swift_ures_open
swift_ucasemap_open

The generated command links Foundation, FoundationEssentials, and FoundationInternationalization, but appears not to include several required static archives, including _FoundationICU, _FoundationCollections, _FoundationCShims, and swiftSynchronization.

This occurs on Linux ARM64 when soto-codegenerator is used as a SwiftPM build-tool plugin. Adding those libraries explicitly as conditional linker settings appears to work as a package-level workaround.

Has anyone else encountered this with Swift 6.4 and --static-swift-stdlib on Linux? Is this likely a Swift/Foundation auto-linking issue, or should packages add these linker settings themselves?

Related GitHub issue: soto-codegenerator#102.

I believe this is tracked by `--static-swift-stdlib` fails when linking Foundation · Issue #1764 · swiftlang/swift-build · GitHub and has a fix in the next release branch.

3 Likes

Thanks @FranzBusch, good to know this is already tracked. :)

I'll keep an eye on #1764 and hope the fix ships in the next release as soon as possible.