Xcode 12 beta 4 - error compiling for Simulator

An existing framework library workspace compiles without error when targeting iOS device architecture, but when targeting Simulator I receive the following error:

Code Block
Code Block
ld: in /Users/macbook/Documents/Projects/iOS/HungerStation/Code/customer-app-ios/Pods/mopub-ios-sdk/MoPubSDK/Viewability/MOAT/MPUBMoatMobileAppKit.framework/MPUBMoatMobileAppKit(MPUBMoatAnalytics.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

As per this https://developer.apple.com/forums/thread/655316

Changing build setting "Build Active Architecture Only" from No to Yes doesn't solve this problem

Has anyone else seen this?
Hello,

To all the people with the "ARCHS[@]: unbound variable" error after setting the iOS Simulator SDK to arm64 and who can build for a real device (also for Any IOS Device(arm64)) but can't build the Simulator. I solved my problem following the answer from the user called trishcode in this Stack Overflow post:

https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios

What you need to do is:
  1. Remove what you did earlier, you MUST NOT set the iOS Simulator SDK to arm64,

  2. Set the VALIDARCHS variable with an empty value using a User-Defined build setting, you must set this in the project not in the target (in the main project and Pods project if you are using CocoaPods).

  3. Clean and build the project with a Simulator selected (I used iPhone 11).

    • The build will fail. After it fails, go to the project and delete the VALID

  4. ARCHS variable (in Pods project too).
  5. Check that the VALIDARCHS variable is not present in any project or target. Check the main project and the Pods project. Even though you set the VALIDARCHS variable in the projects, check the targets too because when I deleted it from the projects, the variable was still present in the targets. Like I said, remove VALIDARCHS in both the projects and the targets.

  6. After all the VALID

  7. ARCHS variables have been deleted, build the project again with a Simulator selected and it should build without the error of "ARCHS[@]: unbound variable".
Please check the Stack Overflow post for a better explanation of the solution.

Good luck.
Errors mentioned in here while deploying to simulator using xcode 12 are also one of the things which have affected me. Just right clicking on each of my projects and showing in finder, opening the .xcodeproj in Atom, then going through the .pbxproj and removing all of the VALIDARCHS settings. This was is what got it working for me.

Tried a few of the other suggestions (excluding arm64, Build Active Architecture Only) which seemed to get my build further but ultimately leave me at another error. Having VALID
ARCH settings lying around is probably best thing to check for first.
CVD442 Thanks for your solution:


Errors mentioned in here while deploying to simulator using xcode 12 are also one of the things which have affected me. Just right clicking on each of my projects and showing in finder, opening the .xcodeproj in Atom, then going through the .pbxproj and removing all of the VALIDARCHS settings. This was is what got it working for me.
Tried a few of the other suggestions (excluding arm64, Build Active Architecture Only) which seemed to get my build further but ultimately leave me at another error. Having VALIDARCH settings lying around is probably best thing to check for first.


Lost 2 days on this - bah! Want to give REAL Kudos to those who actually helped solve this problem:

stschwar @ github in this post: https://github.com/CocoaPods/CocoaPods/issues/10059
pointed to this SO post with a simple solution: https://stackoverflow.com/questions/63391793/xcode-12-build-target-in-wrong-order/63405201#63405201

XCode has a deserved 3 stars for many reasons, this is one of them! Counterproductivity kills.
Add line "arm64" (without quotes) to path: Xcode -> Project -> Build settings -> Architectures -> Excluded architectures
Also do the same for Pods. In both cases for both debug and release fields.
I hope this will help.
Best regards.
Some respondents have solved this problem on Intel chip MAC machines
But If I want run this on Apple Silicon Mac ,How to fix ,
In Apple Silicon , I meet same problem
Code Block
building for iOS Simulator, but linking in object file built for iOS, file '../SDK/***.framework/***' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


How to fix it ?
Hope someone can give a perfect answer

Hey, I have a solution that worked for a React Native project I had.

Xcode:
  • Project -> Build Settings -> Architectures -> Exclude Architectures
    • Add "Any iOS Simulator SDK" with a value of arm64 for both debug and release.

VS Code or Mac Terminal
  • Open a terminal for your project.

    • run command npx react-native run-ios

I struggled for a long time trying to add the arm64 to the excluded Architectures and cleaning the app/ rebuilding to get things to work. I tried all the other things I could find through other forums, but it wasn't until I tried to build the app with the npx command in a different terminal that the projects properly linked. The build was successful and will start a simulator. I just exited out of that simulator, went back to Xcode, ran the app again and it worked. I don't have a reason as to why this worked for me, but something else for you all to try.







Same issue. This is frustrating. I have a new Macbook Pro with the M1 chip.
If you are developing a React Native based solution and you are using NVM for local Node versioning, the error may be due to this.

XCode cannot find the Node version, of course XCode fetches the Node in the / usr / local / bin / node directory and NVM stores the Node in another directory like Users / $ {my-user} /. Nvm / versions /node/v14.16.0/bin/node

To work it is enough to create an alias for XCode to find the Node in its default search:

ln -s $ (which node) / usr / local / bin / node
If you are developing a React Native based solution and you are using NVM for local Node versioning, the error may be due to this.

XCode cannot find the Node version, of course XCode fetches the Node in the /usr/local/bin/node directory and NVM stores the Node in another directory like Users/${my-user}/.nvm/versions/node/v14.16.0/bin/node

To work it is enough to create an alias for XCode to find the Node in its default search:

ln -s $ (which node)/usr/local/bin/node

Try to install pod again Open terminal change your project directory install pod

If you were using an SSH client you should add authentication : security unlock-keychain -p

We need to add 'arm64' in excluded architecture if you are trying to run in simulator and remove the same if you are running in a real device.

Xcode 12 beta 4 - error compiling for Simulator
 
 
Q