Canvas preview for Widget fails to compile

Number:rdar://FB8619450 Date Originated:09/03/2020
Status:open Resolved:
Product:Xcode Product Version:14 beta 7
Classification: Reproducible:
I added a Widget target to my project. If I build and run the Widget scheme everything works and I can see the widget in the simulator. But if I try to see the preview (clicking "resume") in the Canvas the compilation fails with an error about openssl libcrypto.a not having the correct architecture.

>ld: in /Users/username/Dev/iPhone Dev/ProjectName/openssl-1.0.2g-iOS/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file (/Users/username/Dev/iPhone Dev/ProjectName/openssl-1.0.2g-iOS/lib/libcrypto.a(cryptlib.o)) built for iOS, file '/Users/username/Dev/iPhone Dev/ProjectName/openssl-1.0.2g-iOS/lib/libcrypto.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please note that openssl is not in the header search path or the library search path for the Widget target. They are in the target of the main iOS app and they build and run with no issue both on the device and the Simulator.

Also note that libcrypto.a contains libraries for all architectures.
This is the result of the command file libcrypto.a:

> file libcrypto.a
libcrypto.a: Mach-O universal binary with 5 architectures: [i386:current ar archive] [arm_v7s] [arm_v7] [x86_64] [arm64]
libcrypto.a (for architecture i386):	current ar archive
libcrypto.a (for architecture armv7s):	current ar archive
libcrypto.a (for architecture armv7):	current ar archive
libcrypto.a (for architecture x86_64):	current ar archive
libcrypto.a (for architecture arm64):	current ar archive

Many warnings are also displayed that in normal compilation aren't there about other targets having bitcode disabled (not true: they all have bitcoin enabled, and when compiling both the app and the widget scheme this warnings are not displayed)

> ld: warning: all bitcode will be dropped because '/Users/username/Library/Developer/Xcode/DerivedData/ProjectName-cvlnfysptxebwcaeifxqmaltnndr/Build/Intermediates.noindex/Previews/ProjectName/Products/Debug-iphonesimulator/WhatsNewKit.o' was built without bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. 




Excluding arm64 architecture in build settings for all the targets makes both the error and the warnings go away. Excluding it only for the Widget target is not enough.

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!