Swift on Fedora, All Good

Re-reading my previous post about the difficulties in keeping Swift playing nice with other software in /usr/bin, I came up with a different idea that worked extremely well when I tested it on my local machine: install the entire Swift toolchain in /usr/libexec/swift. The rational is this: The Swift toolchain is very sensitive to locations of files and libraries; executables assume they can invoke other executables in the same directory, and there are explicit references to libs located in ../lib.

So instead of trying to fight it, I opened an issue with the packaging committee to allow the package to be reconfigured to:

  • Install the entirety of the Swift toolchain in /usr/libexec/swift
  • Symlink swift, swiftc, and sourcekit-lsp from /usr/libexec/swift/bin to /usr/bin
  • Remove the swift-lang-runtime package

The last issue is because there is no guaranteed ABI stability for the Linux version of Swift and I felt it would be better to not pretend that would work as an update to swift-lang would also update swift-lang-runtime as well, as there are no weak dependencies between the two packages. Thus I feel it was more prudent to consolidate everything under swift-lang.

This setup has worked so much better; I was able to happily remove a whole set of patches to fiddle with the source to change where to look for other programs, and maintaining Swift has become a lot easier insofar as I don't worry about whether it's my rather invasive changes that are breaking everything. This has been working through multiple versions of 5.2 and, as of this writing, has been working for 5.3-dev as well.