Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Bus error 10" after update to Xcode 10.2

I updated Xcode to new stable 10.2v. I tried to build my project and it was successful. When I'm trying to archive the project (workspace), I'm getting errors like on screenshot below:

What I've tried so far:

  1. Update cocoa pods to latest version -> COCOAPODS: 1.7.0.beta.3
  2. Clean DeliveredData folder
  3. Reinstall Xcode
  4. Remove repository, clone it again and install pods
  5. Totally remove all pods from project and add them back
like image 399
iTKerry Avatar asked Mar 28 '19 11:03

iTKerry


3 Answers

Temporary Workaround

For me it was only the Cache framework. Until they have fixed it, you can manually set SWIFT_OPTIMIZATION_LEVEL to -Onone for the configuration you want to use for archiving.

CocoaPods

You could even use your Podfile if you don't want Cococapods to overwrite the settings every time you run pod install

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if target.name == 'Cache'
                config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
            end
        end
    end
end

Note that this is specifically checking for the Cache framework. If you have problems with other frameworks you might want to change or extend this condition.

like image 186
Lukas Würzburger Avatar answered Oct 19 '22 21:10

Lukas Würzburger


While Lukas' answer of disabling optimization on the Cache pod works, I followed Alex's link to the issue in their GitHub repo and found there is an open pull request with a pretty simple code change that fixes it. I unlocked the file and made the change locally.

Here's the PR: https://github.com/hyperoslo/Cache/pull/236

Apply this diff: https://github.com/hyperoslo/Cache/pull/236/commits/560f00a9a9549db161ca70d96eed74fc580b03e3#diff-9e53dc1370d4f7c9cdaaa103d26ff096

Which, to repeat here, is in the file MD5.swift change the safe_add function to be:

func safe_add(_ x: Int32, _ y: Int32) -> Int32 {
  return x &+ y
}

(Disclaimer: I do not claim to know the correctness of the change, but it seems the delay merging the PR is due to figuring out who is currently maintaining the repo.)

like image 3
Chadwick Avatar answered Oct 19 '22 21:10

Chadwick


The answer is here: https://github.com/hyperoslo/Cache/issues/238

We are waiting for the owners of this repo to make any sign of life...

like image 1
iTKerry Avatar answered Oct 19 '22 19:10

iTKerry