Xcode won't build for universal binary

I am porting a macOS Objective-C app from just Intel silicon to universal binary -- Intel and Apple silicon both -- using Xcode 13.2.1, building on a 2019 Mac Pro running macOS 11.6.4. I have followed all the instructions here: https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary. In particular, in Xcode's "build" settings, "Architectures" is set to "Standard Architectures (Apple Silicon, Intel) - $(ARCHS_STANDARD)", and "Build Active Architecture Only" is set to "No".

Yet when I use Xcode to build either the release or the debug version of my app, the shell command:

lipo -archs <path to MyApp.app>/Contents/MacOS/<MyApp>

returns only "x86_64", and indeed, the app doesn't even start initialization when I test it on a Mac Mini with Apple silicon.

What could I be doing wrong?

Post not yet marked as solved Up vote post of Knightley Down vote post of Knightley
3.4k views
  • I am the original poster; I have more information and have sort of solved the problem, but there may be a problem with Apple's documentation or with Xcode, so I comment further here.

    My problem was that the Xcode build setting "VALID_ARCHS" was set to just "x86_64". When I set it to "arm64 x86_64", I was able to build for both architectures, and my app ran on both kinds of silicon. However:

    (1) There was no mention of "VALID_ARCHS" in Apple's documentation at https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary. Between that lack, and the fact that I had forgotten that the "VALID_ARCHS" setting existed, I didn't think to look for it, and only stumbled across it after a lot of thrashing.

    (2) Various documentation appears to indicate that the "VALID_ARCHS" setting is going away. If so, should Xcode have paid attention to it?

Add a Comment

Replies

I’m glad you found your problem.

For more background on this, see TN3117 Resolving architecture build errors on Apple silicon.

You wrote:

Various documentation appears to indicate that the VALID_ARCHS setting is going away.

Correct.

If so, should Xcode have paid attention to it?

That’s the difference between “going away” and “gone away”. The setting is deprecated, but that’s just the first step in removing it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I'm having the same issue, only that I'm using $(ARCHS_STANDARD). lipo -archs only returns x86_64 and Xcode only shows the option to run the project with My Mac (Rosetta), where all my other projects can also be run on Mac and have the same architectures set.

I was also bitten by this problem. If this happens, it is like the OP said: you still have the VALID_ARCHS setting on your build settings. The trick is to scroll ALL THE WAY down to the user-defined build settings, because when this setting became deprecated it was moved down to the bottom of your build settings. Once you DELETE (yes, delete it with the delete button) this build setting, another option called My Mac will show up besides the My Mac (Rosetta) option and then you can build an Apple Silicon version of your Mac app. If you have more than one target, you need to repeat this for each target you have on your project.

I had this issue after I upgraded to a MacBook Air M2 and Ventura, and was rebuilding an app that had only ever been built on/for Intel. The problem was in the Xcode "Product > Destination >" menu, which was set to "My Mac (Rosetta)". Changing that to "My Mac" eliminated the problem of asking to install Rosetta when I launched it from within Xcode. Xcode version is 14.1.