Here are a bunch of errors I’ve run into while writing code and the fixes for them.

Swift

Empty files libswiftCompatibility56.a and libswiftCompatibilityPacks.a

Building an iOS app with minimum requirements of Swift 6 and iOS 18, I kept running into these build errors:

ld: multiple errors: file is empty in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCompatibility56.a'; file is empty in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCompatibilityPacks.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

All my build settings in XCode were set to Swift 6 and iOS 18.

Turns out one of the third-party packages I was using had this in its Package.swift:

let package = Package(
  name: "FooBar",
  platforms: [
    .iOS(.v15),
  ],

I forked the repository and changed the platform to ‘.iOS(v.18)’ and the build errors went away.