Xcode Previews error: symbol(s) not found for architecture arm64

Xcode version: 14.1 beta 3 (14B5033e)

It happens often to me that when I try to run the Xcode previews I see a failure of the type

symbol(s) not found for architecture arm64

The full message looks like:

LinkDylibError: Failed to build BannerImageDemoView.swift



Check the issue navigator for any compilation errors. 



ld: warning: directory not found for option '-F/Applications/Xcode-beta.app/Contents/SharedFrameworks-iphonesimulator'

Undefined symbols for architecture arm64:

  "_$s8SATSCore11BannerImageV13imageViewData5titleAcA0ceF0OSg_SStcfC", referenced from:

      _$s7DemoApp011BannerImageA4ViewV0ab20_PreviewReplacement_cdaE2_1E15__preview__body33_E76125F4FD74D49C73B828FC57CA03FALLQrvg7SwiftUI05TupleE0VyAG6SpacerV_8SATSCore0cD0VAKtGyXEfU_ in BannerImageDemoView.1.preview-thunk.o

  "_$s8SATSCore11BannerImageV7SwiftUI4ViewAAMc", referenced from:

      _$s8SATSCore11BannerImageVAC7SwiftUI4ViewAAWl in BannerImageDemoView.1.preview-thunk.o

  "_$s8SATSCore11BannerImageVMa", referenced from:

      _$s7DemoApp011BannerImageA4ViewV0ab20_PreviewReplacement_cdaE2_1E15__preview__body33_E76125F4FD74D49C73B828FC57CA03FALLQrvg7SwiftUI05TupleE0VyAG6SpacerV_8SATSCore0cD0VAKtGyXEfU_ in BannerImageDemoView.1.preview-thunk.o

      _$s7SwiftUI6VStackVyAA9TupleViewVyAA6SpacerV_8SATSCore11BannerImageVAGtGGWOh in BannerImageDemoView.1.preview-thunk.o

      _$s8SATSCore11BannerImageVWOc in BannerImageDemoView.1.preview-thunk.o

      _$s8SATSCore11BannerImageVAC7SwiftUI4ViewAAWl in BannerImageDemoView.1.preview-thunk.o

      _$s8SATSCore11BannerImageVWOh in BannerImageDemoView.1.preview-thunk.o

      _$s7SwiftUI9TupleViewVyAA6SpacerV_8SATSCore11BannerImageVAEtGWOb in BannerImageDemoView.1.preview-thunk.o

      _$s7SwiftUI9TupleViewVyAA6SpacerV_8SATSCore11BannerImageVAEtGWOc in BannerImageDemoView.1.preview-thunk.o

      ...

  "_$s8SATSCore11BannerImageVMn", referenced from:

      _symbolic _____y_____y___________ACtGG 7SwiftUI6VStackV AA9TupleViewV AA6SpacerV 8SATSCore11BannerImageV in BannerImageDemoView.1.preview-thunk.o

      _symbolic _____y_____y_____y___________ACtGG_Qo_ 7SwiftUI4ViewPAAE15navigationTitleyQrAA18LocalizedStringKeyVFQO AA6VStackV AA05TupleC0V AA6SpacerV 8SATSCore11BannerImageV in BannerImageDemoView.1.preview-thunk.o

      _symbolic _____y___________ABtG 7SwiftUI9TupleViewV AA6SpacerV 8SATSCore11BannerImageV in BannerImageDemoView.1.preview-thunk.o

      _symbolic _____y___________y___________ADtGG 7SwiftUI13_VariadicViewO4TreeV AA13_VStackLayoutV AA05TupleD0V AA6SpacerV 8SATSCore11BannerImageV in BannerImageDemoView.1.preview-thunk.o

      _symbolic ___________AAt 7SwiftUI6SpacerV 8SATSCore11BannerImageV in BannerImageDemoView.1.preview-thunk.o

  "_$s8SATSCore13ImageViewDataOMa", referenced from:

      _$s7DemoApp011BannerImageA4ViewV0ab20_PreviewReplacement_cdaE2_1E15__preview__body33_E76125F4FD74D49C73B828FC57CA03FALLQrvg7SwiftUI05TupleE0VyAG6SpacerV_8SATSCore0cD0VAKtGyXEfU_ in BannerImageDemoView.1.preview-thunk.o

      _$s7SwiftUI6VStackVyAA9TupleViewVyAA6SpacerV_8SATSCore11BannerImageVAGtGGWOh in BannerImageDemoView.1.preview-thunk.o

      _$s8SATSCore11BannerImageVWOc in BannerImageDemoView.1.preview-thunk.o

      _$s8SATSCore11BannerImageVWOh in BannerImageDemoView.1.preview-thunk.o

      _$s7SwiftUI9TupleViewVyAA6SpacerV_8SATSCore11BannerImageVAEtGWOb in BannerImageDemoView.1.preview-thunk.o

      _$s7SwiftUI9TupleViewVyAA6SpacerV_8SATSCore11BannerImageVAEtGWOc in BannerImageDemoView.1.preview-thunk.o

      _$s7SwiftUI9TupleViewVyAA6SpacerV_8SATSCore11BannerImageVAEtGWOh in BannerImageDemoView.1.preview-thunk.o

      ...

  "_$s8SATSCore13ImageViewDataOMn", referenced from:

      _symbolic _____Sg 8SATSCore13ImageViewDataO in BannerImageDemoView.1.preview-thunk.o

ld: symbol(s) not found for architecture arm64

This happens when trying to build the previews for this file

https://github.com/sats-group/SATSCore-iOS/blob/main/DemoApp/DemoApp/Views/Components/BannerImage/BannerImageDemoView.swift

our set up is:

  • The DemoApp is inside the repo of the library called SATSCore
  • SATSCore references a private SPM package dependency called SATSType that contains the private font assets

I am not that familiar on how linkers work and why it's failing on Xcode previews.

This happens to me in several version of Xcode 14.

In Xcode 13.4.1 this doesn't happen.

I would like to understand this error, as it's any way to solve this (tried the typical remove derived data + restarting Xcode), so any insights to understand more this kinds of errors would be very helpful.

Thanks

Answered by fespinozacast in 733156022

Feedback reported ID: FB11678756

Mmm.. while development I casually added a line, which made importing the SATSCore framework in the file.

That framework was implicitly available already through the @_exported import SATSCore call in the app’s entry point.

It may seem that this issue may be related to implicitly imported libraries

I should add this only fails with Xcode previews, not when running the app in simulator/device.

I use a M1 Max MacBook pro

Hi,

Sorry to hear you are having problems getting previews working. Best next step will be to file a feedback with diagnostics so we can take a look. We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.

If you are having issues with macOS, catalyst or on-device iOS previews then download and install the logging profile for your device. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift Attach the sysdiagnose to the bug report as well as the diagnostics using the instructions below.

Then when you get an error in Xcode Previews, an error banner appears in the canvas

  1. Click the "Diagnostics" button in that banner (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  2. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  3. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123.zip)
Accepted Answer

Feedback reported ID: FB11678756

Mmm.. while development I casually added a line, which made importing the SATSCore framework in the file.

That framework was implicitly available already through the @_exported import SATSCore call in the app’s entry point.

It may seem that this issue may be related to implicitly imported libraries

Xcode Previews error: symbol(s) not found for architecture arm64
 
 
Q