Failed to build ContentView.swift preview

Diagnostics log:

linker command failed with exit code 1 (use -v to see invocation)


LinkDylibError: Failed to build ContentView.swift

Linking failed: linker command failed with exit code 1 (use -v to see invocation)

ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator' Undefined symbols for architecture arm64:  "_longjmperror", referenced from:    _platform_posix_longjmperror_wrapper992 in shared(result.o)    (maybe you meant: knifunptr_platform_posix1018_longjmperror, _platform_posix_longjmperror_wrapper992 ) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

==================================

| BuildInvocationError |   | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -F /Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator -target arm64-apple-ios14.1-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -L/Users/arbonik/Library/Developer/Xcode/DerivedData/iosApp-cpeocagckjhkzagmqdmaffwjekpd/Build/Intermediates.noindex/Previews/iosApp/Products/Debug-iphonesimulator -F/Users/arbonik/Library/Developer/Xcode/DerivedData/iosApp-cpeocagckjhkzagmqdmaffwjekpd/Build/Intermediates.noindex/Previews/iosApp/Products/Debug-iphonesimulator -F/Users/Shared/BonchRestaurant/iosApp/Pods/../../shared/build/cocoapods/framework -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -ObjC -lc++ -framework shared -framework Pods_iosApp -bundle -bundle_loader /Users/arbonik/Library/Developer/Xcode/DerivedData/iosApp-cpeocagckjhkzagmqdmaffwjekpd/Build/Intermediates.noindex/Previews/iosApp/Products/Debug-iphonesimulator/iosApp.app/iosApp /Users/arbonik/Library/Developer/Xcode/DerivedData/iosApp-cpeocagckjhkzagmqdmaffwjekpd/Build/Intermediates.noindex/Previews/iosApp/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/arm64/ContentView.1.preview-thunk.o -o /Users/arbonik/Library/Developer/Xcode/DerivedData/iosApp-cpeocagckjhkzagmqdmaffwjekpd/Build/Intermediates.noindex/Previews/iosApp/Intermediates.noindex/iosApp.build/Debug-iphonesimulator/iosApp.build/Objects-normal/arm64/ContentView.1.preview-thunk.dylib -framework SwiftUI

Hi,

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

  1. When you get an error in Xcode Previews, an error banner appears in the canvas
  2. Click the "Diagnostics" button in that banner
  3. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  4. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Similar error for a view within an SPM target (attached). Filed FB11663508. Using Version 14.0.1 (14A400).

Failed to build ContentView.swift preview
 
 
Q