Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't build macOS project after updating to Xcode 10.2/Swift 5

Tags:

My project built fine before updating Xcode.

Now however, I can no longer build the project. When using Swift 5, building the project just never finishes. It stops on "Building 70 of 100 tasks" and just never finishes. Those numbers aren't always the same, either, but it never finishes building.

If I try to use Xcode to convert my project from Swift 4.2 to Swift 5, it similarly never finishes converting.

If I try changing the toolchain to use the Swift 4.2.1 release toolchain, the code compiles successfully but I get this crash immediately at runtime:

dyld: Symbol not found: _$SBOWV
  Referenced from: /Users/compc/Library/Developer/Xcode/DerivedData/Swift_Coder-hczsehpbafcwkfgwyameucznmhsp/Build/Products/Debug/Swift Coder.app/Contents/MacOS/../Frameworks/SavannaKit.framework/Versions/A/SavannaKit
  Expected in: /usr/lib/swift/libswiftCore.dylib
 in /Users/compc/Library/Developer/Xcode/DerivedData/Swift_Coder-hczsehpbafcwkfgwyameucznmhsp/Build/Products/Debug/Swift Coder.app/Contents/MacOS/../Frameworks/SavannaKit.framework/Versions/A/SavannaKit

I've tried cleaning the project and deleting derived data but neither seems to work.

The project continues to build and run perfectly fine if I use Xcode 10.1.

like image 665
CompC Avatar asked Mar 26 '19 21:03

CompC


1 Answers

I had problems with some of my code involving extending the ClosedRange type to Encodable and Decodable in a custom way. In Swift 5, ClosedRange already conforms to Encodable and Decodable when its Bound is Encodable and Decodable, but the compiler wasn't giving me an error about the redundant conformance, instead just hanging on compilation.

After I modified my code to use the new Swift 5 protocol conformance, it compiled fine. It took a long time to narrow down the problem to this, however. It seems to me to be a bug in the Swift Compiler because the compiler hangs in a Playground or from the command line as well, even on a different Mac.

like image 158
CompC Avatar answered Oct 19 '22 13:10

CompC