55

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.

dr_barto
  • 5,723
  • 3
  • 26
  • 47
Alex
  • 577
  • 1
  • 5
  • 3

14 Answers14

64

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

Harvinder Singh
  • 1,919
  • 21
  • 15
  • 2
    If you don't find EXCLUDED_ARCHS = arm64; in VSCode and ios/App/App.xcodeproj/project.pbxproj then open project in Xcode then search in Xcode and remove the whole line containing EXCLUDED_ARCHS. – sanjeev sharma Feb 10 '21 at 16:40
  • 1
    My builds work fine on xcode 12.5, however App Center only supports xcode 12.4 for now and it breaks there... Somehow this fixed everything, God thank you so much. – Samuel Willems Jun 16 '21 at 20:39
  • This worked for me, however should be noted it's only wise to do this for releases not debug if you have an M1 mac as you need to exclude arm64 to run anything on an M1 mac now. – user2086359 Jan 04 '22 at 13:07
  • 1
    As far as I understand, when you use Mac M1 (Silicon), you need only exclude arm64 architecture for simulator configurations, but not for builds to be released on AppStore or AppCenter – RadekR Jan 14 '22 at 16:33
  • 1
    This was exactly what I needed. Recently got an M1 Pro and was playing around excluding arch to get it to run on a simulator. Thought I'd deleted all references in Xcode but this manual way worked perfectly. I just run in Rosetta mode now if I need the simulator – adougies Feb 14 '22 at 22:16
  • Hey Guys I am facing issue in M1 Pro while archive Build. Please help me. – Kudos May 19 '22 at 14:26
  • Not working for me – Abdul Basit Mangat Jul 20 '23 at 09:51
  • 3 months! I was looking for a solution and this worked! mind you, the problem started SUDDENLY..smh – Thinkerman Sep 01 '23 at 20:50
27

For Xcode 12.3, when there is no VALID_ARCHS property, follow below steps:

  1. Build Settings -> Build Active Architecture Only -> Debug -> Yes
  2. 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.
Shivani Bajaj
  • 996
  • 10
  • 23
23

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. wrong configuration

  • But it should be like this. Only for Any iOS Simulator SDK in both Debug and Release. correct configuration

Then my error fixed.

I think this will help you. Happy coding!

shenith sandeepa
  • 436
  • 4
  • 10
17

You may try below steps:

  1. In Main Project(Not TARGETS), Go to build settings and add Simulator-iOS 14.0 SDK with value arm64 inside Excluded Architecture and repeat the same for the Pod project too.
  2. 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 ✅ ]
  3. Upgrade all Pods to the latest version available.

Last, Clean Project and Re-Build.

Sunil Targe
  • 7,251
  • 5
  • 49
  • 80
  • 1
    The first step also worked for me when excluding `arm64` to `Any iOS Simulator SDK` only in the main project. I changed nothing in the pods project. – Ángel Téllez Nov 07 '20 at 22:10
  • When I build my project to simulator it works but always fails with this error when creating an archive file. – ArdenDev Nov 20 '20 at 03:58
  • @ÁngelTéllez are you able to create an archive ? – ArdenDev Nov 20 '20 at 03:59
  • Yes, I can. Maybe you deleted the `VALID_ARCHS` only for DEBUG configuration?. Make sure that you deleted also the flag for your RELEASE configuration. – Ángel Téllez Nov 20 '20 at 05:44
  • @ÁngelTéllez Sorry i am new to this I cannot find VALID_ARCHS – Khadija Daruwala May 06 '21 at 10:25
  • 2
    @PersianBlue the `VALID_ARCHS` should be at the bottom of your **Xcode 12** project's Build Settings, in the `User-Defined` section. But this `VALID_ARCHS` setting only applies for projects created with Xcode 11 and below; so if you do not find it in your Xcode 12 project, it is ok, you do not have it. The former was replaced by the `EXCLUDED_ARCHS` setting. (More info about this in the [Build System deprecations section of the Xcode 12 release notes](https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes#Build-System)) – Ángel Téllez May 06 '21 at 20:20
11

In our case, we needed to add x86_64 to VALID_ARCHS to build on simulator. enter image description here

Nike Kov
  • 12,630
  • 8
  • 75
  • 122
11

In my case for Xcode 13.1, Here's what I did:

  1. Build Settings -> Build Active Architecture Only -> Debug -> No (both project and pods project)
  2. 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

soufianeios
  • 448
  • 5
  • 11
10

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:

enter image description here

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.

Karatekid430
  • 940
  • 11
  • 25
7

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

Danil
  • 69
  • 1
  • 1
6

enter image description here

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
ayhnhakn
  • 107
  • 3
  • 8
4

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

tinmarfrutos
  • 1,740
  • 1
  • 14
  • 23
2

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:

  • Choose the architecture either x86_64 for the simulator or arm64 for the device picture 1
  • Check VALID_ARCHS list contains the target architecture picture 2
  • Launch pod install command (the step propagates the right architecture to the pod-generated Xcode projects)
  • Build and launch the application
1

In build-settings, set VALID_ARCHS to $(ARCHS_STANDARD).

vidalbenjoe
  • 921
  • 13
  • 37
-1

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"

Sreeraj
  • 11
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '21 at 16:39
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30467786) – MD. RAKIB HASAN Dec 01 '21 at 06:15
-1

running it on a physical device fixed my issue

leo
  • 113
  • 3
  • 11