102

After migrating my framework to Xcode 10 beta (10L176w) I started to get warnings like:

Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform.

... and:

Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform.

Despite these warnings the build and the unit tests all pass Ok. I'm using Swift 4.2.

Still, what are these warnings about?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
0x416e746f6e
  • 9,872
  • 5
  • 40
  • 68
  • I am seeing this when setting when trying to build 64 bit only using `ARCHS = $(ARCHS_STANDARD_64_BIT)` and `VALID_ARCHS = $(inherited) x86_64 i386` – Kdawgwilk Jul 18 '18 at 00:26

14 Answers14

104

Go to Build Settings and do as shown below

enter image description here

Hassan Taleb
  • 2,350
  • 2
  • 19
  • 24
  • 6
    I confirm, this worked for me - I don't know why, but those settings were highlighted in bold both on project and target build settings. Then I deleted as mentioned above (in both places!), and this just removed bold highlight (reverted to defaults, obviously), and the warnings are gone – Nick Entin Oct 02 '18 at 07:30
  • 24
    Just to clarify, this must be done on both the project and target. – Pouria Almassi Oct 14 '18 at 23:17
  • 2
    Nice answer, I propose for this to be the solution. – Heider Sati Oct 16 '18 at 17:37
  • 11
    When I deleted it, nothing shows up in Resolved and I get `There are no valid architectures to compile for because the VALID_ARCHS build setting is an empty list` – Crystal Oct 19 '18 at 17:27
  • 2
    seems to not work any longer. I'm getting the same problem Crystal is reporting with Xcode 11 beta 6. @John's answer works for me instead – Fabian Streitel Aug 21 '19 at 19:26
  • This worked for me too. I had previously set the "Valid architectures" manually and it seems the settings are no longer valid since the default architectures are now different. – Mani Aug 31 '19 at 11:37
  • 1
    @Crystal Press "Delete" on the line in the picture, instead of on the line's value part. The line will be light grey and not bold any more. – DawnSong Jan 02 '20 at 12:37
  • 1
    In Xcode 12 valid architectures has disappeared, and my code was not compiling. I had to g back to Xcode 11 and remove the valid architectures I'd added and then save to get my code to compile in Xcode 12. – raeldor Aug 16 '20 at 00:26
71

I was able to silence these warnings by changing my Valid Architectures setting to $(ARCHS_STANDARD) which matches my Architectures setting as well.

Oddly, this displayed as armv7 arm64 (in comparison to the default setting of armv7 armv7s arm64), but setting it to that value manually still caused the warnings. Not sure what the significance of that is, but I haven't noticed any problems in my testing yet.

Paulo Mattos
  • 18,845
  • 10
  • 77
  • 85
John Montgomery
  • 6,739
  • 9
  • 52
  • 68
27

You likely have the VALID_ARCHS ("Valid Architectures") build setting overridden, either for the target or for its project. This is a build setting that should get its value automatically based on which run destination you're building for. When you figure out where this override is coming from (the build setting will display in bold when overridden), select it and hit the delete key to restore it to the default value.

Rick Ballard
  • 4,765
  • 2
  • 19
  • 17
  • 2
    I also see this error. I have not overridden the settings `VALID_ARCHS`. It contains `arm64` for both debug and release. – funkenstrahlen Jun 20 '18 at 12:03
  • 10
    This appears to be a bug in Xcode 10. Still occurs with default settings – Kdawgwilk Jul 17 '18 at 23:50
  • 5
    This but still seems to appear with the release version of Xcode 10. Anyone have any update on this? – plivesey Sep 17 '18 at 20:18
  • 1
    me2, i was just googling about this, but to no avail – MegaManX Sep 20 '18 at 11:01
  • I found it easiest to open the project file in a text editor, then you can find and delete all of the VALID_ARCHS lines easily. – Max Mar 12 '19 at 17:13
  • 2
    I needed to go to all my sub projects and targets and delete `VALID_ARCHS` to set it to default and then clean and close / open Xcode again for it to work fully for me – manman Apr 12 '19 at 19:42
18

For the TARGET which report warnings, Change the "Valid Architecture" setting to:

$(VALID_ARCHS)
x86_64

enter image description here

Quanhua Guan
  • 445
  • 5
  • 9
8

Similar to other answers, I was able to remove the warning by changing $(VALID_ARCHS) (Valid Architectures) to $(ARCHS_STANDARD). From there, I cleared all Derived Data and restarted Xcode 10.0. This made the warning go away completely. Deleting everything from Valid Architectures just made a different warning appear ("No valid architectures found").

jldailey
  • 371
  • 2
  • 5
3

I am also facing the same problem. For resolution, I have just changed the build system from Standard to Legacy and that resolved the issue.

ScottM
  • 7,108
  • 1
  • 25
  • 42
2

The solution is simpler: in Valid Architectures just replace arm64 with x86_64.

Had similar issue and the following three warnings in my project: Had similar issue and the following warning in my project

My Valid Archtectures originally were My **Valid Archtectures** originally were

Replacing:

  • armv7 with i386,
  • armv7s with i386,
  • and, arm64 with x86_64

(as mentioned in the Warnings) was my solution. The result in the Valid Architecture setting was:

Replacing armv7 with i386, armv7s with i386, and, arm64 with x86_64 as mentioned in the Warnings was my solution

After the replacements my three warnings above disappeared.

More profound info about the Architectures can be found here: https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/

I think the formulation of this warning in Xcode is a bit confusion.

Dharman
  • 30,962
  • 25
  • 85
  • 135
CGN
  • 579
  • 4
  • 13
2

If you are facing problem in Flutter:

  1. Delete the Podfile, Podfile.lock, Pods folder, Runner.xcworkspace, Flutter.framework.

  2. Run flutter clean.

  3. Run flutter build ios.
Deepak Ror
  • 2,084
  • 2
  • 20
  • 26
0

I was seeing this warning when I tried to compile code for both iOS and Mac OS. I was able to get around it by first doing what Hassan Taleb suggested in his answer: clear out the architectures so that only valid iPhone architectures are in there. And then finally, to maintain being able to build for Mac OS, wave your mouse over the Valid Architectures so that a plus button appears. Click that and then you can add separate settings for different platforms as needed, including different CPU architectures. For macOS SDK, I can set my Valid Architectures to just x86_64 if I want. For macOS SDK, I can set my Valid Architectures to just x86_64 if I want

joelliusp
  • 436
  • 8
  • 18
0

I found the easiest way to resolve this was to open the project in my text editor, then find and delete all VALID_ARCHS lines.

Jonathan
  • 13,947
  • 17
  • 94
  • 123
0

I have seen the same warning as I building my framework. After a while noticed these valid architecture values vary depending on the type of devices regardless the values in build settings.

Real devices-> arm64 
Simulator devices ->x86-64
grape100
  • 341
  • 4
  • 11
0

Go to Target > Build Settings > Architectures >Excluded Architectures (x84_64) .. It is used to Run a Real device And Use (arm64) to Run a Simulator For (Any SDK).

If selected Excluded Architectures > Debug and Release

1

2

To solve this problem virtually and radically, you have to choose ( Any IOS Simulator SDK) instead of (Any SDK) and set value (arm64) In this case, you can make a build and a run together without having to change the values each time.

3

BoP
  • 2,310
  • 1
  • 15
  • 24
0

Swift 5+

post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
end

end

Shakeel Ahmed
  • 5,361
  • 1
  • 43
  • 34
-2

if your [build Settings] is armv7 armv7s arm64, please delete armv7s. the warning will be cancelled.

Brody
  • 2,074
  • 1
  • 18
  • 23
  • it is not just about armv7, it's a general issue and your suggestion is not forward looking – amok Nov 01 '19 at 22:06