I'm having a strange issue with a package of my own that I'm working on and I'm unsure if this is a bug in Swift 5.3, Xcode 12b (most likely) or if I'm just doing something wrong.
I have a library that I'm working on called Validations
. It has a dependency on a library called Validated
, which in turn has a dependency on a library called NonEmpty
.
My Package.swift file is here:
To test everything is OK with the package, I created an example Xcode project - just an empty SwiftUI app - using Xcode 11 and added my package using Xcode's package management facility. I can build and run the project in the simulator and the Xcode previews are working fine.
If I open the same project in Xcode 12, I can still build the project and run it in the simulator but if I try and load an Xcode preview, it fails with the following error:
linker command failed with exit code 1 (use -v to see invocation)
----------------------------------------
SchemeBuildError: Failed to build the scheme "ExampleApp"
linker command failed with exit code 1 (use -v to see invocation)
Link Validations (x86_64):
Undefined symbols for architecture x86_64:
"protocol conformance descriptor for NonEmpty.NonEmpty<A> : Swift.Sequence in NonEmpty", referenced from:
(extension in Validations):Validated.Validated.reduceErrors<A>(A1, (A1, B) -> A1) -> Validated.Validated<A, A1> in Validations.o
"type metadata accessor for NonEmpty.NonEmpty", referenced from:
(extension in Validations):Validated.Validated.mapErrors<A>((B) -> A1) -> Validated.Validated<A, A1> in Validations.o
(extension in Validations):Validated.Validated.reduceErrors<A>(A1, (A1, B) -> A1) -> Validated.Validated<A, A1> in Validations.o
closure #1 (A1) -> Validated.Validated<A1, B> in Validations.ValidatorOf.pullback<A>((A1) -> A) -> Validations.ValidatorOf<A1, B> in Validations.o
closure #1 (A?) -> Validated.Validated<A?, B> in Validations.ValidatorOf.optional(errorOnNil: B?) -> Validations.ValidatorOf<A?, B> in Validations.o
closure #1 (A) -> Validated.Validated<A, B> in Validations.ValidatorOf.negated(withError: B) -> Validations.ValidatorOf<A, B> in Validations.o
closure #1 (A) -> Validated.Validated<A, A1> in Validations.ValidatorOf.mapErrors<A>((B) -> A1) -> Validations.ValidatorOf<A, A1> in Validations.o
closure #1 (A) -> Validated.Validated<A, A1> in Validations.ValidatorOf.reduceErrors<A>(_: A1, reducer: (A1, B) -> A1) -> Validations.ValidatorOf<A, A1> in Validations.o
...
"NonEmpty.NonEmpty.map<A>((A.Element) throws -> A1) throws -> NonEmpty.NonEmpty<[A1]>", referenced from:
(extension in Validations):Validated.Validated.mapErrors<A>((B) -> A1) -> Validated.Validated<A, A1> in Validations.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have the same problem with Xcode's new playground support for Swift packages - if I create an empty playground, check the "Build Active Scheme" box and try and run the playground it fails with the same error as above.
Any pointers here would be helpful - am I doing something wrong, or is this a bug in Xcode 12 that should be reported via the Feedback Assistant?