Swift compiler fails with no message

I'm trying to port an iOS app to Catalyst. It has a number of Cocoapods framework targets, and some (not all) of them are failing to build, with Xcode 11.4.1 reporting "Command CompileSwift failed with a nonzero exit code"


Inspecting the build transcript, there is no output from the compiler hinting as to why it failed. So I don't have anything to go on.


Does anyone have any suggestions for how to troubleshoot in a situation like this? Surely this is a compiler bug - if it fails to compile something, it should always output some kind of message explaining why.


Of course I've cleaned, relaunched, rebuilt, etc. to rule out transient Xcode quirks. I even tried building from the command line with xcodebuild, and that failed in the same way (without providing any extra clues, as far as I could tell)


Here's a screenshot explaining what I mean. Notice the target that has failed to build on the left, and on the right there is nothing but green ticks.

Are they your CocoaPods or third party's ? Maybe they have to be recompiled.

Third party. But they contain source code, nothing pre-compiled.

Surely this is a compiler bug

Yes. This symptom means that the compiler has crashed, either in a controlled manner (it hit an assert) or not (for example, a memory access exception). All such crashes are bugworthy. As you say, the compiler should either work or fail with an error.

Please file a bug about this. It would be great if you could include a project that reproduces the problem but, if that’s not possible, you should still file a bug with your full build transcript.

I’d appreciate you posting your bug number, just for the record.

You can get the full build transcript as follows:

  1. Go to the Report navigator (View > Navigators > Show Report Navigator).

  2. In the navigator on the left, select the failed build.

  3. At the top right of the editor you should see an Export button. Click that.

  4. Save the transcript somewhere convenient and then attach that to your bug.

The full build transcript may also offer some idea as to what’s going wrong. Specifically, if the compiler hit an assert it logs a backtrace, and that backtrace might contain hints as to where you’re failing.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Ok, i've filed a bug: FB7680742

Ok, i've filed a bug: FB7680742

Thanks for that.

However, are you sure you get the right build transcript? I took a look at the one you attached to the bug report and the only

nonzero exit code
I see is this one:
Command CodeSign failed with a nonzero exit code

)-:

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yes, another library target is now reporting a CodeSign error related to its resource bundle, but 5 Swift library targets are failing to build with the compiler error that i mentioned. Check out the screenshot that I uploaded alongside the build transcript. The screenshot and the transcript definitely come from the same build. I clicked 'Export' right after taking the screenshot.

I’m sorry but I don’t use CocoaPods and so can’t offer specific guidance for how to export the right build transcript. You will need to poke around to find the transcript for the build where CompileSwift is failing.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I'm facing a similar issue. Were you able to solve this?

Same thing is happening to me, but ONLY when compiling for My Mac (Mac Catalyst). It has been working fine, for iOS/iPadOS, for years.

Swift compiler fails with no message
 
 
Q