0

I'm getting a build error when trying to build my Swift Package Manager package:

Command CompileSwiftSources failed with a nonzero exit code

This always occurs on the dependencies of my package such as KeychainSwift & ReactiveKit (tho I've seen it on other dependencies).

I have tried deleting derived data, restarting Xcode, restarting my computer, going to File > Packages > Reset Package Caches, tried on both Xcode 13.2 beta 2 & Xcode 13.1. Additionally I have verified that my package dependencies are up to date, with no success.

Charlie Fish
  • 18,491
  • 19
  • 86
  • 179

1 Answers1

0

Turns out as I was writing this question, I decided to create a new package to see if I could reproduce it. Just copying the Package.swift file worked fine and didn't reproduce the error.

But after copying my path/source files I got a completely different error about how I can't use macOS storyboards in an iOS target.

On that example project I was able to add the following to the target:

exclude: [
    "ViewControllers/macOS"
],

This fixed the build issues on that example package. So I replicated that on the primary package, and it worked perfectly, no build errors.

I have absolutely no idea why Xcode showed a random error message instead of a detailed one that could help me debug further. But hopefully this advice helps someone. Try creating a brand new package, and seeing if that produces a better error message, and ensure that you aren't mixing platform specific code into one target.

Charlie Fish
  • 18,491
  • 19
  • 86
  • 179