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