Missing symbol from libswiftCore.dylib: _swift_getExtendedExistentialTypeMetadata

I have a Swift package with many targets that form a dependency stack, and after making some changes the package now experiences an immediate run-time crash when run on my iPhone. The crash message is along the lines of:

symbol not found: _swift_getExtendedExistentialTypeMetadata
expected in /usr/lib/swift/libswiftCore.dylib

The crash does not occur on the iOS simulator. It doesn't occur on the macOS app that runs the same package. The same error does appear, however, when attempting to archive on any platform. I'm going to attempt to slowly reverse all the recent changes I made before noticing the crash on iOS, but any help would be hugely appreciated if anyone knows what's going on (@Slava_Pestov as the most likely candidate, but please simply disregard if not, and I'm sorry to distract you!)


I succeeded in whittling the problem down to the following:

public struct Foo {
   let bar: @MainActor ()->any Baz<Void>
protocol Baz <A> {
   associatedtype A

To reproduce, paste the above code into a module that is part of a macOS or iOS app and then archive.

After reducing the problem code, the error changed slightly:
error build: Undefined symbol: _swift_getExtendedExistentialTypeMetadata_unique

Could you file an issue on GitHub?

cc @Slava_Pestov @hborla

This might be the same issue as https://github.com/apple/swift/issues/61403. To help narrow this down, can you first try building without optimizations?

1 Like

Sure I’d be happy to, but actually I don’t know how. Is it easy to describe how to build without optimizations?

I am assuming you’re building with a Xcode, so a debug build will have optimizations turned off by default (and a release build will have it on by default). You can also change them via build settings by changing “Optimization Level”. Or if you’re building from command line you can pass -Onone for no optimisations and -O for optimizations.

@Slava_Pestov is the fact that the build succeeds in debug mode but fails in release mode (given that my defaults are the standard) enough information for you? Or do you want me to try archiving with optimization turned off?

I bet this relates to "Build Active Architecture Only" setting: by default it is set to "yes" in debug builds and "no" in release builds.