4

I have updated to Xcode 10.2. When I try to get an archive I am getting Illegal instruction: 4 error for following pod dependencies:

  • AKSideMenu
  • Cache
  • IQKeyboardManagerSwift
  • Eureka
  • SwiftDate

My project Swift version is set to 4.2. I am able to build and run my project on a device. I have tried to set Swift version to 5 for all my dependencies but it didn't work. I have also tried to restart my computer and clearing Xcode archives and derived data.

Before posting this question I have also disabled inhibit_all_warnings!in my pod file and run pod update and try to archive again but this time I got Command SwiftCodeGeneration failed with a nonzero exit code error for all pods listed above and Bus error: 10 for pod  Cache.

How can I fix this?

UPDATE:

Please look at this question for solution:

Xcode 10.2, Swift 5, Command compileSwift failed while build the program with Release Scheme

Go to project build settings Project → Build Settings → Swift Compiler - Code Generation → Compilation Mode → Release and set to Incremental

This is working but building an archive is taking too much time.

UPDATE 2:

For my project problem was related to pod Cache which gives error when Optimization Level for Release is set to Optimize for Speed [-O]. I have set Compilation Mode to Whole Module again and set optimization level for the pod in pod file:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    # Cache pod does not accept optimization level '-O', causing Bus 10 error. Use '-Osize' or '-Onone'
    if target.name == 'Cache'
      target.build_configurations.each do |config|
        level = '-Osize'
        config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = level
        puts "Set #{target.name} #{config.name} to Optimization Level #{level}"
      end
    end
  end
end

Refrence: https://github.com/hyperoslo/Cache/issues/233#issuecomment-477749560

Olcay Ertaş
  • 5,987
  • 8
  • 76
  • 112
  • Are you sure all your pods support Swift 5? Try compile all your dependencies with Swift 4.2? – Tj3n Mar 28 '19 at 08:55
  • Hi, if you have found an answer to your own question, please write an actual answer (and then accept it) instead of just editing the question. That way, people with the same problem will know at a glance that you have a solution. – JeremyP Mar 28 '19 at 09:54
  • My question is duplicate of the question I have mentioned. So there is no need to add an answer. I have tried to close my question as duplicate but I couldn't reference the question although I have the link to it. – Olcay Ertaş Mar 28 '19 at 10:45
  • second update (pod post_install) solved my "Bus error: 2" and "ilegal instruction 4" problem, thanks! – Petr Fiala Mar 29 '19 at 18:40

0 Answers0