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?
I have multiple schemes and my application build setting is not reflecting in the pod . After adding this code in an iteration I changed pod "Build Active Architecture Only" to YES which fixed the issue

Code Block
 config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'

I am having the same issue and changing "Build Active Architecture Only" from No to Yes also does not solve the problem.
Even i am having the same problem . But when i run the same code base with xcode 11.3.1 then it works fine for me .
Right now i am unable to debug for ios 14 . Build active architecture to "Yes" doesnt solve the problem.
Facing the same issue. Please let me know here if you guys find anything useful.
For people facing this issue, @kiji123's answer actually worked for me
Just make sure you're setting this "Build active architecture" option on the pods targets as well, you can do this by adding this to your Podfile:
Code Block ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
   target.build_configurations.each do |config|
    config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
   end
  end
end

and running pod install
The answer of @atahhan fix my issue for the module AppBoy, as well.

Enjoy :)
Running into the same thing as well. Hoping the next version of Xcode 12 beta fixes this issue. Setting "Build Active Architecture Only" to "Yes" does not fix the issue for me either.
same issue for me
I slove problem by :
Xcode -> Build Setting -> Excluded Architectures in target project and target Pod add : arm64
I've tried all of the above, and I'm getting this error:

Pods-{myprojectname}-}frameworks.sh: line 144: ARCHS[@]: unbound variable

Command PhaseScriptExecution failed with a nonzero exit code
Hi, I still have this issue with Xcode beta 5, even though I put ONLYARCHIVEARCH = YES.
Any progress anyone ?
We are also facing the same solution. The "Build Active Architecture Only" from No to Yes doesn't solve this problem. Has anyone got a solution?
Try upgrading the Project Xcode compatibility to Xcode 11 and change the VALIDARCHS to $(ARCHSSTANDARD).
It worked for me
I have the same issue for Realm framework
hi, i have the same issue... works in real device and not work in simulator, any ideas?
Hi, I am facing the same issue, I have deleted the variable "VALID_ARCHS" from "build settings", it solved the architecture issue but my project fails to build at last.


Code Block
Showing Recent Messages
Resource "/Users/ikjotsingh/Library/Developer/Xcode/DerivedData/OrderPay-cfxtbumiszxnyohjotjyvymxenhc/Build/Products/Debug-iphoneos/ModularUICore/ModularUICore.framework/ColorAssets.car" not found. Run 'pod install' to update the copy resources script.

it shows the above error, its somehow that my pods are not being installed correctly
/Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName-frameworks.sh: line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

Anyone knows how to fix this on xcode 12 ? tried all of the above nothing works
kiji123 Thanks - Work your solution:
I have multiple schemes, I searched in all documents of my project "ONLYACTIVEARCH" and then I changed the parameter ONLYACTIVEARCH = NO in the scheme whit error and fixed the issue.

I build a FAT development framework for distribution which needs to contain arm and intel slices. Forcing it to build just active architecture is not a solution for me. I have been playing with using external myCodeSettings.xcconfig file containing lines like the following:

Code Block
EXCLUDE_ARCHS_FOR_Release_iphoneos=i386 x86_64
EXCLUDE_ARCHS_FOR_Release_iphonesimulator=arm64 arm7s armv7
EXCLUDE_ARCHS= $(__EXCLUDE_ARCHS_FOR_$(CONF)_$(PLATFORM_NAME))

and associate the myCodeSettings.xcconfig in General project settings tab on specific targets that need to build.

Appeared to work, by replacing the subsequent EXCLUDEARCHS dynamically based on what you are trying to build.

There was one build failure so I was looking into applying similiar technique for VALID
ARCHS and ARCHS settings.

Anyone feel they have been successful and post their solution?
I don't believe you can remove all architectures from VALIDARCHS or ARCHS or the build will be successful but Xcode would not compile nor link anything for the framework or library.

The log should contain a message indicating no archs were specified.

Same is true if you exclude all architectures within EXCLUDE
ARCHS .



For a general short term solution to this issue, the exclusion of arm64 arch needs to be specifically tied to iOS Simulator platform build.

If solution is not tied to iOS Simulator platform, you are telling Xcode to never build for the arm64 arch.

This solution doesn't work for me since I need to distribute FAT framework with all the iOS archs and all the iOS Simulator archs.

The newer Xcode 12 is treating arm64 as an iOS Simulator architecture as well as a legacy iOS architecture probably because MacOS Big Sur 11 running on an Arm64 based Mac will be running the iOS Simulator on arm64... But the Xcode folks didn't appear to think thru the affects.

Xcode 12 UX needs to be able to differentiate arm64 iOS Simulator from arm64 iOS in a better way. The generated binary need to include extra metadata so linker can tell choose the correct arch within a FAT library framework without displaying error because it chose unwisely.
@chimcanhcutptit@gmail.com sloved my problem,thank you
Just adding some more info. Xcode 12.2 Beta Release Notes includes this note:

Swift Packages
Known Issues
Swift Packages may not respect the “Build Active Architecture Only” project build setting when you try to build universal binaries. (64344067)

Workaround: Use the “Any Mac”, “Any iOS Device (arm64)”, “Any watchOS Device”, or “Any tvOS Device” destination to build for all applicable devices.

I know it's kinda unrelated because it's Xcode 12.2 (which none of us is probably using yet), and it's related to Swift Packages, but maybe this is also the case on Xcode 12 GM and non-Swift Package builds.
My project used VALID_ARCHS.

Removing only that build setting in Xcode 12 made the app runnable on the simulator.

Removing VALID_ARCHS required first clearing out its setting values. Then I was able to delete the entry itself and successfully build and run on the sim.
As mentioned in the previous replies, the issue appears to be Xcode 12's inclusion of arm64 arch in the iPhone simulator, thus causing a clash between iPhone and Simulator when they are being combined to create the fat library.

So I followed kai_kai and @chimcanhcutptit@gmail.com's recommendation below and appears to have solved the problem (I was able to run my library in both simulator and real device). Basically the solution is to exclude arm645 architecture from the iphone simulator. This could have an impact when testing on arm64 macs later on - or may be not.

Select the project or target -> Build Settings -> Excluded Architecture (if you can't see it make sure [All] properties are selected) and set the Excluded Architecture for 'Any iOS simulator SDK' -> 'arm64'.
Xcode 12 beta 4 - error compiling for Simulator
 
 
Q