Depending on the framework incorporated into the application, the following error may occur and prevent the iOS simulator from running on an Apple Silicon Mac.
ld: in /Volumes/Data/src/RK/TechGakuWebSite/SampleCodes/OpenCVTest_iOS/common/opencv2.framework/opencv2(ios_conversions.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This example of error output occurs in OpenCV 4.6.0. This article will show you how to deal with it.
Error Cause
When an app was built with arm64
for the iOS simulator on an Apple Silicon Mac, it seems to be due to the fact that the framework for the iOS device was linked to the build for the iOS simulator when the framework incorporated was not fully compatible with Xcode 12 or later architecture or Apple Silicon.
How to deal with it
Apple Silicon Macs have Rosetta2, so binaries built with the x86_64
version can still be used in the iOS simulator and Xcode’s SwiftUI preview.
When building for the iOS simulator, configure it not to build with arm64
. Do the following.

