'ARCHS[@]: unbound variable in Xcode 12
Our iOS project is built successfully in Xcode 11. However, on Xcode 12, it shows an error like this:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/NgoHoangLien/Library/Developer/Xcode/DerivedData/BeneKitten-asctqxwawireafgebpjujkfxjvcg/Build/Intermediates.noindex/BeneKitten.build/Debug-iphoneos/BeneKitten\ Dev.build/Script-6F989132ECCA2B13FEF9458F.sh (in target 'BeneKitten Dev' from project 'BeneKitten')
cd /Users/NgoHoangLien/Project/Benekitten-iOS
/bin/sh -c /Users/NgoHoangLien/Library/Developer/Xcode/DerivedData/BeneKitten-asctqxwawireafgebpjujkfxjvcg/Build/Intermediates.noindex/BeneKitten.build/Debug-iphoneos/BeneKitten\\\ Dev.build/Script-6F989132ECCA2B13FEF9458F.sh
sent 1868986 bytes received 70 bytes 3738112.00 bytes/sec
total size is 1868525 speedup is 1.00
/Users/NgoHoangLien/Project/Benekitten-iOS/Pods/Target Support Files/Pods-BeneKitten Dev/Pods-BeneKitten Dev-frameworks.sh: line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code.
I followed guides on the internet to make "arm64" for EXCLUDED_ARCHS
. Delete VALID_ARCHS
. But it still cannot compile. I hope you the senior engineers, experts like you can help me.
Solution 1:[1]
Note :- React native developers After wasting couple of hours only solution that worked for me was
Open VSCode and go to directory ios/App/App.xcodeproj/project.pbxproj that file and perform a search EXCLUDED_ARCHS
EXCLUDED_ARCHS = arm64;
and delete everyline containing EXCLUDED_ARCHS
Solution 2:[2]
For Xcode 12.3, when there is no VALID_ARCHS property, follow below steps:
- Build Settings -> Build Active Architecture Only -> Debug -> Yes
- Add "arm64" in "Excluded Architectures" in build settings of both project and pods project, to run the app in simulator. Remove it while making build on device or archiving the app.
Solution 3:[3]
You may try below steps:
- In Main Project(Not TARGETS), Go to build settings and add
Simulator-iOS 14.0 SDK
with valuearm64
insideExcluded Architecture
and repeat the same for thePod
project too. - Delete
VALID_ARCHS
from your Main project and Pod project both.(You may open the project file in editor to delete this) [You already did this ? ] - Upgrade all Pods to the latest version available.
Last, Clean Project and Re-Build.
Solution 4:[4]
In my case for Xcode 13.1, Here's what I did:
- Build Settings -> Build Active Architecture Only -> Debug -> No (both project and pods project)
- Remove the "arm64" in "Excluded Architectures" in build settings of both project and pods project.
I was running on my real device if you try with simulator you might need to do the opposite
Solution 5:[5]
Solution 6:[6]
Make sure that in your Project -> build settings -> Excluded Architecture and Pods -> build settings -> Excluded Architecture
The same values.
In my case, this soap is due to in Project architecture was arm64 but in Pods nothing
Just remove arm64 from Excluded Architecture if you start Archive or installing on real device
Solution 7:[7]
I got this error in my React Native app and finally found the issue and the fix.
Initially I added the arm64 for all 4 like this in Build Settings -> Architectures -> Excluded Architecture. And this was my issue.
But it should be like this. Only for Any iOS Simulator SDK in both Debug and Release.
Then my error fixed.
I think this will help you. Happy coding!
Solution 8:[8]
The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor. (15145028)
-> https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes
It works for me by removing VALID_ARCHS
lines on my project.pbxproj
Solution 9:[9]
All the answers here are probably wrong for your project, and have the potential of breaking your project. You can only remove excluded archs completely if all your pods use xcframework and are ready for the arm64 simulator architecture.
The correct answer is to remove excluded archs from directly to the right of "Debug" and "Release", and add arm64 for excluded arch for "Any iOS Simulator SDK" only:
Adding arm64 as an excluded arch directly to the right of "Debug" and "Release" will exclude arm64 for the physical iOS device, and all physical iOS devices are arm64, hence why the build cannot be packaged.
Solution 10:[10]
I've got the same issue here.
I want to launch the application either on a connected device or on a simulator. And I get the error ARCHS[@] unbound variable
trying to use the simulator.
Steps to fix the issue:
Solution 11:[11]
you need to open this page and delete excluded architectures inside debug
and release
section if it is default arm64
delete it!
- clean your project (cmd + shift + k)
- clean derived data (dev.cleaner)
- and restar your mac
Solution 12:[12]
In build-settings, set VALID_ARCHS to $(ARCHS_STANDARD).
Solution 13:[13]
i had the same issue once we converted to XCFramework, fixed by(still not for debugging and only for archiving)
1.build active architecture only - YES 2.remove arm64 from excluded architecture( if it was given) 3.valid_archs - arm64 (only arm64 )
after that i am able to build successfully on "any device"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow