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?
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?