Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

I'm using Xcode 10.2, Swift 5.

With Debug scheme, no issue happens, but with Release scheme when I build or archive, it shows Command compileSwift failed with a nonzero exit code.

I've tried delete DerivedData / Clean / pod deintegrate & pod install & pod update. None of these works.

enter image description here enter image description here

like image 572
Ran Bi Avatar asked Mar 26 '19 07:03

Ran Bi


2 Answers

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

like image 166
Olcay Ertaş Avatar answered Nov 03 '22 01:11

Olcay Ertaş


I fixed this issue by going Pods Project then to the building settings and setting Compilation Mode to Incremental for Release. Then clean and archive, should compile fine then.

like image 28
Neil Faulkner Avatar answered Nov 03 '22 00:11

Neil Faulkner