Incremental compilation has been disabled: it is not compatible with whole module optimization on Release build configuration

Hey Developers I'm facing some strange situation, I'm getting multiples issues related to optimization on Release build configuration, I'm using Xcode 13.2.1

project is separated in 4 markets and multiples frameworks none of the markets have dependencies from each other, issue only appears when the market RefrreshAtPumpAUS Release is build, on the other side for Debug everything is functional and the app build fine.

here's my Podfile:

in order to add the : def adobe_manager_pods into the framework: CoolMasterUtilsFramework

as the project is in 4 different markets had to added in the different markets like this: 

  target 'RefrreshAtPumpNL' do
     
    # Pods for RefrreshAtPump
    common_pods
    adobe_manager_pods --> here
   
  target 'RefrreshAtPumpUS' do
   
   # Pods for RefrreshAtPump
   common_pods
   firebase_pods
   adobe_campaign_pods
   adobe_manager_pods. --> here
   
  target 'RefrreshAtPumpUK' do
   
    
   # Pods for RefrreshAtPump
   common_pods
   adobe_manager_pods --> here

but for the AUS market(RefrreshAtPumpAUS) is quite different already had added similar PODS

  target 'RefrreshAtPumpAUS' do
   
   # Pods for RefrreshAtPump
   common_pods
   firebase_pods
   adobe_experience_pods. ->> here

they have this so, I added the 2 remaining that I needed for that specific market.

  def adobe_experience_pods
   pod 'AEPAudience', '~> 3.0’ ------->> THIS ONE
   pod 'ACPUserProfile', '~> 2.2’ ------->> THIS ONE
   pod 'AEPEdgeIdentity', '~> 1.0'
   pod 'AEPEdgeConsent', '~> 1.0'
   pod 'AEPCore', '~> 3.0'
   pod 'AEPIdentity', '~> 3.0'
   pod 'AEPSignal', '~>3.0'
   pod 'AEPLifecycle', '~>3.0'
   pod 'AEPUserProfile', '~> 3.0'
   pod 'AEPEdge', '~> 1.0'
   pod 'AEPMessaging', '~> 1.0'
   pod 'AEPAssurance', '~> 3.0', :configurations => ['Debug']
  end

so if I run the project in all other markets as RELEASE or DEBUG everything goes well, but only for RELEASE on RefrreshAtPumpAUS

shows errors like this: 

I've tried

adding lines inside the RefrreshAtPumpAUS like this:

1.- post_install do |installer|

2.- Pod update

3.- delete all Derived data

4.- in Build settings -> Apple Clang - Code generation -> Optimization level to None[-O0]

5.- in Build settings -> Build active architecture only -> ALL to YES

6.- in podfile -> delete this line use_frameworks! and adding use_modular_headers! 

7.- in Build settings -> Swift compiler -> Code generation -> Incremental to all

Found any solutions? The same problem started happening to me when I updated XCode to version 13.2.1.

The same problem for me started when I updated XCode 13.3

I'm facing the same issue on Xcode 13 version. Has anyone found a fix?

I'm also facing the issue after updating Xcode to 13.3. The project compiles and runs fine without any problem, but whenever I try to generate the Archive to upload to TestFlight, it is throwing this error: "error: Abort trap: 6. Remark: Incremental compilation has been disabled: it is not compatible with whole module optimization. Command CompileSwiftSources failed with a nonzero exit code."

Same here ... No solution yet ?!

Same here, i use xcode 13.3

After 3 days of headache, I installed the previous version 13.2 of XCode, I can FINALLY compile in Archive.

Same here, 13.1 -> OK, 13.3 -> Failure

So I get this error as well. I use Flutter and the error ist thrown in two of the packages I use - so not my code - when I try to archive my project (just like this answer Incremental compilation has been disabled: it is not compatible with whole module optimization on Release build configuration - ( https://developer.apple.com/forums/thread/701981 ). I checked my configuration and it's the same as yours. But since I get this error in XCode 13.3 when archiving on my mac AND when I try to build via Codemagic I'm inclined to believe, this has nothing to do with my configuration or settings. I've read on other questions regarding this problem in the past that some people could solve this issue by making some changed in their code. So in my case could it be due to the packages I use? So I downgraded to 13.2.1 and it works on my machine and in Codemagic.

pod deintegrate pod install

This two lines fixed the problem for me

remark: Incremental compilation has been disabled: it is not compatible with whole module optimization Command CompileSwiftSources failed with a nonzero exit code

I have also got this issue and i was able to archive prior to the updation of the pods. When i last updated the pods, it started showing above error.

Anyone able to build archive?

Got solution on the above issue. Please follow the below steps:

  1. Open terminal
  2. Move to the directory of your project
  3. Deintegrate pod
  4. Remove workspace manually
  5. Remove pod file, pod.lock file, Pods folder manually
  6. pod init - terminal
  7. pod install
  8. Open workspace in Xcode
  9. Pods > General > Target > 12.0

IMPORTANT: Let processing complete for the device in Xcode. Worked on XCode 13.2.1

The same problem, caused by upgrading xcode, xcode version 13.3, flutter version 2.8.1.

Solution 1:

Downgrade xocde to 13.2.1

Solution 2:

My computer is M1, so it may not be suitable for you:

1、Delete the pod directory

2、sudo gem pristine ffi --version 1.15.3

3、pod install

4、Open workspace in Xcode ,Pods > Target > 11.0

Test time 2022-04-07 00:30, I only know Chinese, these words are translated by Google

This happened for me as well on 13.3.1. I tried the suggestions here and eventually just had to downgrade in order to build for release.

I have a solution!!!

Just change iOS version for minimal iOS 11 for problems pods. I found this solution on China forum =) I hope this helps you because it helped me, but none of the solutions worked before.

I think the problem is cause by pod. when you upgrade to 13.3, some pod target's option "ENABLE_BITCODE" have been set "YES", so you just need add code to your Podfile, just like this:

post_install do |installer|
   installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
         config.build_settings['ENABLE_BITCODE'] = 'NO'
      end
    end
end

and clean project and delete cache, archive will be success.

Earlier I mentioned that @beruta's solution worked for me but it started failing again. What worked for me is cleaning Xcode project build files.

"About This Mac" -> Storage -> Manage -> Developer

This is also a neat way to clear up some space when you are running out.

That remark isn't an actual error, just a warning. The real error can be found in the nested Compile Swift source files under the top-level section with the same name. Expand the logs for this command and you should see the actual error.

Inspired by ryanavocado.

For me, it was caused by SKPhotoBrowser in my Podfile. After removing it, the error goes away.

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.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/***/Library/Developer/Xcode/DerivedData/***/Build/Intermediates.noindex/ArchiveIntermediates/***/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/SKPhotoBrowser.build/Objects-normal/arm64/SKPhotoBrowser.bc -embed-bitcode -target arm64-apple-ios13.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name SKPhotoBrowser -o /Users/***/Library/Developer/Xcode/DerivedData/***/Build/Intermediates.noindex/ArchiveIntermediates/***/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/SKPhotoBrowser.build/Objects-normal/arm64/SKPhotoBrowser.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 '/Users/***/Library/Developer/Xcode/DerivedData/***-hhhfwlkzxdivscfrppsfvbhllnzc/Build/Intermediates.noindex/ArchiveIntermediates/***/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/SKPhotoBrowser.build/Objects-normal/arm64/SKPhotoBrowser.bc'.
4.	Running pass 'ObjC ARC contraction' on function '@UI_USER_INTERFACE_IDIOM'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x00000001077f8de7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x00000001077f7e38 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x00000001077f9440 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007ff810cf2dfd _sigtramp + 29
4  libsystem_platform.dylib 0x000000031069bae0 _sigtramp + 18446603383459187968
5  libsystem_c.dylib        0x00007ff810c28d24 abort + 123
6  swift-frontend           0x0000000107745cda llvm::report_bad_alloc_error(char const*, bool) + 106
7  swift-frontend           0x0000000107745cf2 out_of_memory_new_handler() + 18
8  libc++abi.dylib          0x00007ff810c9a96b operator new(unsigned long) + 43
9  swift-frontend           0x0000000107506efd llvm::Function::BuildLazyArguments() const + 77
10 swift-frontend           0x00000001052efe87 llvm::objcarc::BundledRetainClaimRVs::insertRVCallWithColors(llvm::Instruction*, llvm::CallBase*, llvm::DenseMap<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*>, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*> > > const&) + 151
11 swift-frontend           0x0000000105302f88 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1384
12 swift-frontend           0x000000010753e380 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1488
13 swift-frontend           0x0000000107545073 llvm::FPPassManager::runOnModule(llvm::Module&) + 67
14 swift-frontend           0x000000010753eb39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1161
15 swift-frontend           0x0000000102a5c6df swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3791
16 swift-frontend           0x0000000102a5d8cc swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2812
17 swift-frontend           0x0000000102a66aa5 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 213
18 swift-frontend           0x0000000102521795 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 16565
19 swift-frontend           0x00000001024e05d4 swift::mainEntry(int, char const**) + 1108
20 dyld                     0x000000020a16151e start + 462
21 dyld                     0x000000020a15c000 start + 18446744073709530288
error: Abort trap: 6 (in target 'SKPhotoBrowser' from project 'Pods')
Incremental compilation has been disabled: it is not compatible with whole module optimization on Release build configuration
 
 
Q