Xcode building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'
Basically, you have to exclude arm64
for the simulator architecture, both from your project and the Pod project,
To do that, navigate to Build Settings of your project and add Any iOS Simulator SDK with value
arm64
inside Excluded Architecture.
OR
If you are using custom
XCConfig
files, you can simply add this line for excluding simulator architecture.EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
Then
You have to do the same for the Pod project until all the Cocoa pod vendors are done adding following in their Podspec.
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }You can manually add the Excluded Architecture in your Pod project's Build Settings, but it will be overwritten when you
usepod install
.In place of this, you can add this snippet in your
Podfile
. It will write the necessary Build Settings every time you runpod install
.post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
building for iOS Simulator, but linking in object file built for iOS
This will do for now
- Find Xcode in your Applications folder.
- Select the app, and then press Command-I (or right-click/use the File menu and select Get Info.). This will open an Info window with details about the app.
- In the Info window, look for a checkbox labeled, “Open using Rosetta”. Check the box.
- Close the Info window.
- If you’re already running the app, quit and relaunch.
Xcode building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'
Basically, you have to exclude arm64
for the simulator architecture, both from your project and the Pod project,
To do that, navigate to Build Settings of your project and add Any iOS Simulator SDK with value
arm64
inside Excluded Architecture.
OR
If you are using custom
XCConfig
files, you can simply add this line for excluding simulator architecture.EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
Then
You have to do the same for the Pod project until all the Cocoa pod vendors are done adding following in their Podspec.
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }You can manually add the Excluded Architecture in your Pod project's Build Settings, but it will be overwritten when you
usepod install
.In place of this, you can add this snippet in your
Podfile
. It will write the necessary Build Settings every time you runpod install
.post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
Xcode error 'building for iOS Simulator, but linking in dylib built for iOS .. for architecture arm64' from Apple Silicon M1 Mac
Answering my own question in a hope to help others who are having similar problems. (and until a good answer is added from another user)
I found out that GoogleWebRTC actually requires its source to be compiled with x64
based on its source depo.
For builds targeting iOS devices, this should be set to either "arm" or "arm64", depending on the architecture of the device. For builds to run in the simulator, this should be set to "x64".
https://webrtc.github.io/webrtc-org/native-code/ios/
This must be why I was getting the following error.
building for iOS Simulator, but linking in dylib built for iOS, file '/Users/andy/workspace/app/Pods/GoogleWebRTC/Frameworks/frameworks/WebRTC.framework/WebRTC' for architecture arm64
Please correct me if I am wrong, but by default, it seems that Xcode running in Apple M1 silicon seems to launch iOS simulator with arm
arch type. Since my app did run fine on simulators in Intel Mac, I did the following as a workaround for now.
- Quit Xcode.
- Go to Finder and open Application Folder.
- Right click on Xcode application, select
Get Info
- In the "Xcode Info Window" check on
Open using Rosetta
. - Open Xcode and try running again.
That was all I needed to do to make my app, which relies on a library that is not yet fully supported on arm simulator, work again. (I believe launching Xcode in Rosetta mode runs simulator in x86 as well..?? which explains why things are working after making the above change)
A lot of online sources (often posted before M1 Mac launch on Nov/2020) talks about "add arm64 to Excluded Architectures
", but that solution seems to be only applicable to Intel Mac, and not M1 Mac, as I did not need to make that change to make things work again.
Of course, running Xcode in Rosetta mode is not a permanent solution, and Xcode slows down lil bit, but it is an interim solution that gets things going in case one of libraries that you are using is not runnable in arm64 simulator.. yet.
building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
What I did was
setting the BuildActiveArchitectureOnly to Yes in the build settings.
And
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
And
Updated my Realm to the latest version.
Related Topics
How to Clear the Entered Textfield When the User Taps on the Button
Force View Controller to Reload to Refresh Uiappearance Changes
Check If There Is an Emoji Contained in a String
Prevent Mobile Safari from Presenting Toolbar When Bottom of Viewport Is Tapped
React Native App Crashes on Launch Screen on Device
Remove Alpha Channel in an Image
How to Create Custom Calendar in React Native
Best Way to Check If Object Is Out of Bounds in Array
Converting Storyboard from Iphone to Ipad
Image Resolution For New Iphone 6 and 6+, @3X Support Added
Xcode 4.2 Debug Doesn't Symbolicate Stack Call
How to Select Multiple Images from Uiimagepickercontroller
Get User'S Current Location/Coordinates
Nsattributedstring Background Color and Rounded Corners
How to Record a Conversation/Phone Call on Ios
Xcode 10.2.1 Command Phasescriptexecution Failed With a Nonzero Exit Code
How to Download Multiple Files Sequentially Using Nsurlsession Downloadtask in Swift