remark: Incremental compilation has been disabled: it is not compatible with whole module optimization [closed]
Asked Answered
C

24

54

Updated to the Xcode 13 beta, now I can't build the project due to an error in several pods

Older Xcode launches an app on iOS 15 too long

I use M1, maybe this is due to architecture

Chaparro answered 16/8, 2021 at 11:26 Comment(0)
S
10

I ran pod update and it fixed the issue for me

Sulfonate answered 2/10, 2021 at 18:38 Comment(1)
yea 1 pod was making trouble so I run pod update "RealmSwift" to update just this pod.Aer
B
50

I faced with issue after updating Xcode to version 13. As the compiler complains about whole module compilation, we need to use the incremental mode.

To do this:

Select your target and go to Build Settings -> Compilation Mode -> Switch to "Incremental"

enter image description here

Bulley answered 28/9, 2021 at 10:44 Comment(7)
When I had build errors I tried this and got the same errorsChaparro
make sure to Clean Build folders beforeTimmy
Cannot find any section for swift compiler or compilation mode under build settingsBouffe
@RachitRawat make sure you have 'all' tabs selectedDoridoria
Additionally, I needed to upgrade my dependencies..Casar
Thank you @EnesKaraosman for the info. If you wish, you can edit my response to add yours.Bulley
Not working for meSchreibe
C
13

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.

Creasy answered 25/8, 2021 at 21:20 Comment(1)
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization Command CompileSwiftSources failed with a nonzero exit code There are no other errorsKerge
S
10

I ran pod update and it fixed the issue for me

Sulfonate answered 2/10, 2021 at 18:38 Comment(1)
yea 1 pod was making trouble so I run pod update "RealmSwift" to update just this pod.Aer
A
9

In my project, pods deployment target was still iOS 8.0. I have added following to my Podfile to upgrade them iOS 13. Then I clean project and removed derived data. After adding following script you need to call pod install.

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      end
    end
  end
Anonym answered 20/12, 2021 at 12:3 Comment(0)
H
6

This issue is due to an upgrade to a new Xcode version.

Go to ->About this Mac -> Storage -> Manage

1 - Delete the files in the developer Xcode Project Indexes files enter image description here

2 - Give it a try again

Hiedihiemal answered 19/5, 2022 at 7:45 Comment(5)
are you sure its not old archive file ? its safe for deleting ?Stephaniastephanie
Yes i am sure. It will just regenerate after you build the project.Hiedihiemal
Not sure how can I access to the page in your screenshot. I think these gets deleted when you clean the build folder. So if clean build folder doesn't work, this won't work as well.Excalibur
Go to ->About this Mac -> Storage -> ManageHiedihiemal
Do you know how to do the same in command line?Crispy
U
5

I downgraded Xcode to 13.2.1 and that solved my problem. Seems 13.3 have this compat issue with some of 3rd party libraries.

Unwelcome answered 21/3, 2022 at 21:21 Comment(0)
P
3

My Xcode 13.3 can't build for device. But it builds for simulators. So I downgraded Xcode to 13.2.1. Problem solved.

Pendleton answered 23/3, 2022 at 4:50 Comment(0)
M
3

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.

Manoff answered 24/3, 2022 at 9:42 Comment(0)
S
3

I also have a similar issue, tried multiple ways but no help.

Finally worked for me:

  1. pod deintegrate
  2. Clean up
  3. pod install
Sunglass answered 5/5, 2022 at 13:36 Comment(0)
C
1
pod update

Updating SwiftMessages pod version from 8.0.2 to 9.0.4 (which didn't not work with Swift 5.5) helped me

Chaparro answered 19/10, 2021 at 6:55 Comment(0)
L
1

This helped me. Answers from developer.apple.com Add this in Podfile

$iOSVersion = '11.0'
post_install do |installer|
# add these lines:
installer.pods_project.build_configurations.each do |config|
  config.build_settings["EXCLUDED_ARCHS[sdk=*]"] = "armv7"
  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
end

installer.pods_project.targets.each do |target|
  
  # add these lines:
  target.build_configurations.each do |config|
    if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
    end
  end
  
end

end

Linell answered 27/12, 2021 at 8:5 Comment(0)
H
1

I have that problem on Xcode 13.3, but after downgraded to 13.1, I can archive successful

Harrelson answered 29/3, 2022 at 1:39 Comment(0)
C
1

What worked for me initially was cleaning Xcode project build files.

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

Xcode project build files

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

Then it started happening again. I then tried selecting "Whole Module" for "Compilation Mode" in "Build Settings". Build didn't fail so far.

Crispy answered 29/4, 2022 at 22:51 Comment(0)
Y
1

I've experienced the same problem due to one of my swift packages lacked 'platforms' specifications in manifest, while at the same time utilising some platform specific framework (SwiftUI in my case)..

Package implementation specified the availability of the api as follows:

@available(iOS 14.0, tvOS 14.0, watchOS 7.0, macOS 11, *)
public extension Font {
//
}

Once I've added the corresponding platform specification in package manifest the problem went away:

let package = Package(
    name: "package-name",
    platforms: [
        .iOS(.v14),
        .watchOS(.v7),
        .tvOS(.v14),
        .macCatalyst(.v14)
    ],
    //
    //
)
Yammer answered 5/5, 2022 at 11:39 Comment(0)
P
1

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')
Prolonge answered 9/5, 2022 at 14:33 Comment(0)
D
1

I had same remark for multiple libraries (ObjectMapper, Alamofire) but that wasn't the actual error (as ryanavocado suggested). In my case I also had segmentation fault error in SKPhotoBrowser so I tried updating the SKPhotoBrowser pod and that didn't work. Luckily this worked:

pod 'SKPhotoBrowser', :git => 'https://github.com/suzuki-0000/SKPhotoBrowser.git', :branch => 'master'

As suggested here.

So in conclusion the problem is not that actual remark but some other error.

Digest answered 15/5, 2022 at 14:4 Comment(0)
M
1

I faced similar issue before I got it fixed. None of the solutions mentioned worked in isolation.

After two days of research and google searches, here is the combination that worked :

1. On the main project (Runner) I updated the compilation mode to incremental by clicking on Build Setting and searching for compilation.

enter image description here

I cleaned the build folder and tried archiving again and got the same error, then I proceeded to the second step.

2. I changed the Apple clang code generation optimisation level to None

enter image description here

I cleaned the build folder and tried archiving again and got the same error. Then I checked that the error message referenced some plugins in the pod

e.g error: Segmentation fault: 11 (in target 'twilio_voice' from project 'Pods')

So, I proceeded to repeating the steps 1 and two above for each pod plugin that had the error.

3. Repeat steps 1 and two above for each pod plugin that had the error. By clicking on the pod and selecting the plugin in context.

enter image description here

I then cleaned the build folder and tried archiving again and still got the same error, then finally after several researches and google searches I executed the following step

4. A. I Added

   config.build_settings['ENABLE_BITCODE'] = 'NO'
   config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'

to the pod file post install script .

The complete script looks like this :

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        'PERMISSION_CAMERA=1',
        'PERMISSION_MICROPHONE=1',
        # Add other permissions required by your app
      ]
       config.build_settings['ENABLE_BITCODE'] = 'NO'
       config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

B. Foreach Pod plugin that had the error, I then changed Enable Bitcode to No, like this :

enter image description here

I then cleaned the build folder and tried archiving again and boom, it worked .

I should also mention that I changed target IOS version to 11, not sure if it had any effect.

Good luck.

Maulmain answered 5/10, 2022 at 16:34 Comment(0)
S
0

Make sure your pods are the same swift version as your project.

Smacking answered 22/10, 2021 at 8:26 Comment(0)
S
0

I found that it was due to a mismatch between a framework and project optimisation build settings.

To fix it the target of the project should be optimised e.g. -Os in BuildSettings -> Apple Clang Code Generation -> Optimisation Level on your project target

It seems swift expects optimisations if compilation mode is set to whole module. Eray's answer works, but might not create optimal assembly/bitcode for a release build of the framework.

Project level compilation mode also needs to be Whole module.

Also noticed this can occur if the dependancy order is incorrect. During a parallel build if a required dependancy of a dependancy has not yet been built, this error can exhibit. Fixed by explicitly adding to the the 1st level dependants Build Phases->Link with Libraries list.

Siliculose answered 23/11, 2021 at 17:35 Comment(1)
For me it was as simple as not including the dependency in the ‘Build Phases → Dependencies’ section. I was archiving target C which depends on target B and package A, and target B depends on package A but package A wasn't listed as one of target B's dependencies. I think building target C incrementally succeeded because target C depends on package A and package A was being built first before target B.Haber
S
0

I did Product -> Clean, then Xcode -> Preferences -> Locations -> Derived Data, go to directory and delete everything. Then close Xcode and reopened and did my build (Archive). All better.

Subtropical answered 19/12, 2021 at 10:51 Comment(0)
B
0

I went with Podfile update as suggested by atalaysa.

Then Preferences > Derived Data > Force Quit Xcode > Deleted Derived Data > Pod Install > Opened the Xcode project > Let the project run through indexing > Archived successfully.

Bunns answered 30/1, 2022 at 10:28 Comment(0)
G
0

Delete iOS Podfile.lock and pubspec.lock and pod deintegrate and pod install. Set in iOS/Flutter folder ApplicationFramework.plist file iOS minimum target to 9.0 and below code in Podfile post install script

post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' end end end

Gittel answered 24/4, 2022 at 13:20 Comment(0)
S
0

you can check once by setting bitcode enbaled false, if u are using framework.

Sniff answered 24/6, 2022 at 15:26 Comment(0)
N
-2

I have a solution!!!

You need to upgrade the iOS version for problem pods to 11 or higher. I hope this helps you because it helped me, but none of the solutions worked before.photo where change

Notepaper answered 22/4, 2022 at 8:31 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Comical
This didn't work for me.Crispy

© 2022 - 2024 — McMap. All rights reserved.