Swift 6 coming soon?

Is anyone doing development with Swift?

When are we going to have Swift 6?

1 Like
1 Like

Swift needs serious clean‐up, potentially a full rewrite, and solving the mysterious Hydra build issues. There are a couple of people who have expressed interest in doing so for 25.05 in the Nix on macOS Matrix room and I’d like to assist such efforts, which should be easier now that Randy’s macOS SDK rework is in.

The plan would ideally be to update to 5.10, the last version that can be bootstrapped without an existing Swift compiler, and then use that to build Swift 6. If you’re interested in helping out then come say hi on Matrix!

3 Likes

What qualifications would be needed to be helpful in this mission?

Knowing things about the Swift build system would be a big help! Experience with Nix packaging would also of course be necessary, and we’d want to make modifications to the existing LLVM package infrastructure to accommodate Swift’s fork. However we already have lots of people with extensive experience with Nixpkgs and LLVM and relatively few with interest and knowledge of the Swift compiler and its build system and bootstrap process, so that’s the skill that would help the effort most on the margin.

I guess I am not there yet.

Another way one could help is by having a body of Swift code that can be tested with the packaged compiler. If Swift support is going to be reworked, it’s an opportunity to improve things for Swift users.

3 Likes

I did a quick search and it seems there aren’t much swift project available in nixpkgs.

If my pull request got merged then then mas package can be tested on:

I have never worked with nixpkgs before though so I can’t guarantee it.

I’ve started work on cleaning up Swift, so I can update it to Swift 6.1. I am targeting it for 25.11, though I expect it to land sooner rather than later.

8 Likes

Thanks for that PR! It helped me find an issue with my changes. When Swift imports a module, it sometimes needs help with headers because it bypasses the Clang wrapper.

Anyway, this is ab example of mas after the update. fetchSwiftPMDdeps is new. It’s similar to fetchCargoVendor. The hook functionality of swiftpm has been split into a separate hook.

My current status is I have Swift 5.10.1 building, which is needed to bootstrap Swift 6.1. I’m currently doing some testing and working on updating the rest of the packages in swiftPackages.

5 Likes

Status update: I have swiftPackages_5 building with all the tools. Swift provides swift-driver. Nothing is wrapped. I have run into a few complications with Swift 6.1.

  • Swift 6.1 has started using C++ in bridging headers, which goes through its ClangImporter library instead of using the wrapped clang binary.
  • Swift 6.1 requires compiler-rt features that only became available upstream in LLVM 20. While Swift builds its own LLVM, it uses the default compiler-rt.

I spent the last few days working on a patch to Swift to make it read libcxx-cxxflags from the clang wrapper. It works and can build Swift 5.10.1 with C++ interop. I expect Swift 6.1 should also work with the patch, but I need to update the default version of LLVM to LLVM 20 (which was planned for 25.11 anyway).

5 Likes