Xcode 13.3 build "out of memory"

Hi everyone,

I'm new to iOS development and CI/CD and wondered if someone may be able to help

We have a build machine that uses Fastlane to build the app and distribute to testers etc

When the Xcode path is set to 13.1 it runs fine and it did on 13.2 (it looks like this version has automatically updated to 13.3 on the build machine)

On my local machine everything compiles fine on 13.1 AND 13.3 but now when the pipeline runs it gets to a certain package/point in the build process and fails with:

LLVM ERROR: out of memory
Allocation failed

The code branch is exactly the same, no changes to packages between Xcode builds. Any idea why 13.3 would throw a memory allocation error and what I could try next? Xcode 13.1 and 13.3 + command lines tools are both installed

Thank you!

  • Just confirmed working in the pipeline with 13.2.1 - guess it's an issue with the latest version?

  • Hi there!

    I'm my case, Xcode 13.3 was breaking with the "LLVM ERROR: out of memory" when archiving. Reading the error log, I've found something interesting: "Embedding bitcode". Well ... bitcode generation is optional. So I've disabled bitcode for that target: Build Settings -> Enable Bitcode = No. And that's it! After turning off bitcode, Xcode 13.3 was able to archive with no more "LLVM ERROR: out of memory". So search for "Embedding bitcode" in your Xcode's error log. If you find it, this is the cure ;-). If not, sorry, can't help you.

  • Thank you for the tip, I will take a look :)

    Being new to iOS development, how important is bitcode? will become mandatory at some point? My very high level. understanding is it's a step to optimise the app binaries?

Replies

I just updated my XCode to the latest version today and encountered this error as well, I don't have a CI/CD setup, just manual build process.

  • In my case it was the Mixpanel-Swift library, installed via CocoaPods.

Add a Comment

I have the same issue.

I have this issue too.

Having the same issue with the ZLPhotoBrowser library. https://github.com/longitachi/ZLPhotoBrowser/issues/699

Seeing the same issue with https://github.com/suzuki-0000/SKPhotoBrowser.

Has anyone found a reliable fix?

Same issue here when archiving. Xcode 13.2.1 was working fine. Xcode 13.3 betas were breaking with the "LLVM ERROR: out of memory" error. Xcode 13.3 final didn't fix this. Message asks to to submit a bug report and include project. Can't include project.

Hi there!

I'm my case, Xcode 13.3 was breaking with the "LLVM ERROR: out of memory" when archiving. Reading the error log, I've found something interesting: "Embedding bitcode". Well ... bitcode generation is optional. So I've disabled bitcode for that target: Build Settings -> Enable Bitcode = No.

And that's it! After turning off bitcode, Xcode 13.3 was able to archive with no more "LLVM ERROR: out of memory".

So search for "Embedding bitcode" in your Xcode's error log. If you find it, this is the cure ;-). If not, sorry, can't help you.

  • it did the trick! Thank you!

  • It worked for me as well! Thank you so much!

  • Confirmed that Xcode 13.3.1 does not solve the "LLVM ERROR: out of memory" when archiving and when error log reports "Embedding bitcode".

Add a Comment

Can confirm that turning off bitcode in a linked framework did the trick with Xcode 13.3.

In my case I am using UI_USER_INTERFACE_IDIOM() that causes Xcode 13.3 with Swift 5.6 to fail. My fix is to replace UI_USER_INTERFACE_IDIOM() into UIDevice.current.userInterfaceIdiom.

  • Fixed for me. Thanks!

  • surprisingly this fixed my case . Thank You !

  • Where to find this line in my code?

Same issue here after updating to Xcode 13.3:

error: backend command failed due to signal 6 (use -v to see invocation)
LLVM ERROR: out of memory
Allocation failed
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.	Program arguments: /Applications/Xcode-13.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /var/folders/7q/ywjd0rsx6zd7vqsy2pgsn_1h0000gp/T/TemporaryDirectory.Vhfg03/CardStackComponents-1.bc -embed-bitcode -target arm64-apple-ios12.2 -Xllvm -aarch64-use-tbi -Osize -disable-llvm-optzns -module-name CardStackComponents -o buck-out/gen/Libraries/uCardStackComponents/CardStackComponents#apple-swift-compile,iphoneos-arm64/CardStackComponents.o
1.	Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
2.	Compiling with the current language version
3.	Running pass 'Function Pass Manager' on module '/var/folders/7q/ywjd0rsx6zd7vqsy2pgsn_1h0000gp/T/TemporaryDirectory.Vhfg03/CardStackComponents-1.bc'.
4.	Running pass 'ObjC ARC contraction' on function '@UI_USER_INTERFACE_IDIOM'

For curiosity, the error doesn't happen if I build with -Onone instead of -Osize. This is not a workaround, obviously. I want to build my releases with optimization.

Same here, having the same issue

Same for me, while creating the archive :(

As suggested, I disabled Bitcode on my main Flutter project and on one of the linked pod (printing)

Then I had to replace UI_USER_INTERFACE_IDIOM() with UIDevice.current.userInterfaceIdiom on DKImagePickerController pod

  • Hopefully these will be resolved - I'm not sure whether I've just been unlucky but Xcode seems to be extremely temperamental. I'm transitioning from mostly .NET development to iOS and while I'm enjoying learning swift and swiftUI the last three minor updates to Xcode have broken our main app in different ways that have been tricky to pin down, one only happened on release builds for iOS 14.

    Is this just the norm or is there a lot of fundamental change in iOS development right now?

Add a Comment

Ultimately switching from UI_USER_INTERFACE_IDIOM() to UIDevice.current.userInterfaceIdiom in a dependency also did the trick (didn't have to disable bitcode in that case).

  • Amazing! It did the trick! Thanks!

Add a Comment

With the new XCODE version 13.3.1, the Bitcode issue is solved

  • I upgraded Xcode to 13.1.1, still, I'm facing the same issue. Also, I tried -Onone instead of -Osize. That also didn't resolve it.

Add a Comment

thanks for this, hopefully nothing new breaks :D