Swift Compilation Hangs on Release Builds

I'm getting an issue where compiling both my macOS and iOS frameworks in Release modes (i.e., Archive) in Xcode 10.2. This happens with both Swift 4.2 and with Swift 5. I can get it to stop hanging by either:

  • Changing Compilation Mode from Whole Module to Incremental
  • Changing Optimization Level from Optimize for Speed to either Optimize for Size or No Optimization


Does anyone know what may be going on here? Is there a likely culprit in my codebase or is this just a compiler bug?

Replies

My understanding is that Xcode 10.3 is a minor update whose primary focus is on shipping new SDKs. I had a look at a few of the bugs mentioned on this thread and it seems that any fixes are targeting Xcode 11. Are you see this problem on the Xcode 11.0 beta release?

Share and Enjoy

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

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

I have downgraded from 10.2.1 to 10.1 and from 10.3 to 10.1. Just download the 10.1 version, unpack it, and replace the existing xcode app with the one you downloaded.


I have the same problem. I can't troubleshoot the issue after trying many things in this thread and others. I found that the build doesn't hang in Xcode 11 beta 4. So I will continue to submit apps to the App Store with Xcode 10.1 until Xcode 11 is officially released, hoping that the released version doesn't bring the issue back.

I just updated my Xcode 11.0 from beta 1 to beta 5 and I can confirm that it finally successfully build and run my app unlike on previous beta builds and Xcode 10.2 - 10.3.

This helped me!


I've checked on Xcode 10.1 the settigs:
Exclusive Access to Memory = Full Enforcement (Run-time Checks in Debug Builds Only)
was the default one. So Apple had to changed that in Xcode 10.2 and 10.3.

I just upgraded from Xcode 10 (no problem) to XCode 11 GM and I now have this issue (archiving product hangs at the "Touch product" phase).

I have tried all suggestions so far in this post :

  • Changing Compilation Mode from Whole Module to Incremental
  • Changing Optimization Level from Optimize for Speed to either Optimize for Size or No Optimization
  • Tried different values for Exclusive Access to Memory
  • Turned on/off disable safety check

None of those had any effect


Created bug report with feedback assistant: FB7251394

This is happening for me as well.

Same here unfortunately 😢. Impossible to archive on Xcode 11 GM (worked perfectly on Xcode10) tried all the same "work arounds" without any luck.

Also wanting to echo this. I’m on Xcode 11 GM and archiving hangs at the “Touch” step on pods. I’ve implemented everything suggested in this thread.

If you’re hitting this problem, please follow the advice in my 2 Apr post.

IMPORTANT One thing that I didn’t make clear in that post is that you should file a bug about this even if there are other existing bugs on file. There’s two reasons for this:

  • There have been multiple causes of these hangs, and it’s important to make sure that yours is covered.

  • The person filing the other bug may not have been able to include a project that reproduces the problem, which makes it much harder to investigate. The project you attach could make all the difference.

Share and Enjoy

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

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

created bug report with Apple Feedback assistant: FB7251394

Another person who is having this problem, have tried all the workarounds mentioned here.

Experiencing also where Archiving is stuck

FB7255868


Filed a bug report with a sample project. Basically it is a new project with few dependencies installed using CocoaPods. Able to build for debug but not able to archive (Stuck on "Touch" for a long time).

Has anyone figured out a workaround for this within Xcode 11? Been banging my head against a wall for a week now.


Alternatively is there any update from the Apple team about whether / when an updated XCode GM will be released?

Incremental build and No optimization for all targets in my project works.

Same story there, can archive projects... Waiting for XCode release or next version to fix this stupid bug.. ((