Xcode Preview fails to build due to linker error

58 Views Asked by At

I have a project with multiple packages. All of these packages are within the same workspace, some of the packages depend on other packages. In the end, an iOS app consumes everything (all my packages, plus multiple cocoapod dependencies and several SPM dependencies).

Everything builds, and all tests pass.

Yet today, when I try to view/edit any of my SwiftUI views within a package, I receive:

== DATE:

    Thursday, 28 March 2024 at 01:08:15 Central European Standard Time
    
    2024-03-28T00:08:15Z



== PREVIEW UPDATE ERROR:

    LinkDylibError: Failed to build OneTimeFundingView.swift
    
    Linking failed: linker command failed with exit code 1 (use -v to see invocation)
    
    ld: warning: search path '/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator' not found
    ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: Undefined symbols:
      (extension in HCPUtilities):SwiftUI.View.hideKeyboard() -> (), referenced from:
          closure #1 () -> () in closure #1 () -> <<opaque return type 
...

xcode-preview-error

Now HCPUtilities is indeed a package that my feature package depends on. When I comment out in the view all the classes/structs/helpers that are referenced from the Utils package, it starts working.

It was working before and is working for my colleagues. What's the catch now?

I have tried reinstalling Xcode, opening just the package. I chose the scheme for just the package and an iPhone 15 (17.2) simulator for the run destination, but I have checked plenty of others... all the same.

0

There are 0 best solutions below