Xcode 15 - Swift Package Manager - undefined symbols

Hello,

Upgrading to Xcode 15 and building for testing ends up with errors.

Note:

  • Xcode 15.1 beta3 & 15.0.1 - normal debug build works
  • Xcode 15.1 beta3 & 15.0.1 - unit test build fails
  • Xcode 14.3.1 - both builds work
  • Using Swift Package Manager to add the packages

Error:

ld: Undefined symbols:
  (extension in PackageX):...-> SwiftUI.Font, referenced from: PackageY... in PackageY.o
(extension in PackageX)...
...
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What I've tried:

  1. clean up project
  2. remove & add involved packages
  3. adding 'other linker flags' to the main target build settings such as -ld64, -ld_classic

What should I update to work in Xcode 15? Thank you.

Accepted Reply

Fixed, I had to delete duplicate framework links from the test target, review your (Test target > Build Phases > Link Binary With Libraries)

Replies

Hello, I faced the same issue. There are two scenarios:

  1. Package A uses multiple 3rd party packages, tests are executed via the test plan in the sample App.
  2. Package B uses library A and several packages which also use our packages, tests are executed via the test plan in the sample App.

case 1 works fine, but case 2 doesn't.

@polikw Have you found any workaround?

Fixed, I had to delete duplicate framework links from the test target, review your (Test target > Build Phases > Link Binary With Libraries)