Xcode 12 is actually the stepping stone for Apple SiliconApple silicon which unfortunately is not yet available (when the answer was written). But with that platform we are gonnagoing to get an arm64 based-based macOS where simulators will also run on the arm64 architecture unlike the present Intel based x86_64-based x86_64 architecture.
Xcode usually depends on the "Run Destination" to build its libraries/appsapplications. So when a simulator is chosen as the "Run Destination", it builds the app for available simulator architectures and when a device is chosen as the "Run Destination" it builds for the architecture that the device supports (
arm*).xcodebuild, in the Xcode 12+ build system considersarm64as a valid architecture for simulator to support Apple Siliconsilicon. So when a simulator is chosen as the run destination, it can potentially try to compile/link your libs/apps againstarm64based simulators, as well. So it sendsclang(++)some -target flag likearm64-apple-ios13.0-simulatorin <architecture>-<os>-<sdk>-<destination> format and clang tries to build/link against an arm64 based-based simulator that eventually fails on an Intel based macMac.But
xcodebuildtries this only for Release builds. Why? Because, "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" build settings is usually set to "No" for the "Release" configuration only. And that meansxcodebuildwill try to build all architectural variants of your libs/apps for the selected run destination for release builds. And for the Simulator run destination, it will includes bothx86_64andarm64now on, sincearm64in Xcode 12+ is also a supported architecture for simulators to support Apple Siliconsilicon.
Simply putting, Xcode will fail to build your appapplication anytime it tries the command line, xcodebuild, (which defaults to release build, see the general tab of your project setting) or otherwise and tries to build all architectural variants supported by the run destination. So a simple workaround to this issue is to set "Build Active Architecture Only (ONLY_ACTIVE_ARCH)" to Yes in your libraries/apps, even for release mode.
One thing I was concerned about that what will be the impact of this when we actually archive the libs/appslibraries and applications. During archiving appsapplications usually take the "Release" configuration and since this will be creating a release build considering only the active architecture of the current run destination, with this approach, we may lose the slices for armv7, armv7s, etc. from the target build. However, I noticed the documentation says (highlighted in the attached picture) that this setting will be ignored when we choose "Generic iOS Device/Any Device" as the run destination, since it doesn't define any specific architecture. So I guess we should be good if we archive our app choosing that as a run destination.

