Xcode not building for arm64 despite correct (?) settings

I have an open-source project, available at https://github.com/MesserLab/SLiM, which uses Xcode (project file SLiM.xcodeproj). In Xcode 12.1 (12A7403), I would like to get a Universal build of the (four) build targets, but let's focus on the SLiM target, which is a command-line tool for macOS. I am on macOS 10.15.7, not macOS 11, but Apple's page (https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary) says nothing about a required macOS version, so I'm under the impression that that is not a problem.

So. In Xcode, I select my SLiM scheme and select a Release build in Edit Scheme. In the project's settings, Architectures is "Standard architectures", base SDK is macOS 10.15, Build Active Architecture Only is "No" for a Release build, and Excluded Architectures is empty. The SLiM target does not override any of those settings, and the "Resolved" column for that target in the Build Settings pane, with the SLiM target selected, shows those values as expected. If I build, it builds without errors (and indeed, without warnings). If I examine the built executable with lipo -archs, however, it is x86_64 only. In the Report navigator, the build log says "Build target SLiM" and then "Project SLiM | Configuration Release | Destination My Mac | SDK macOS 10.15". All of the "Compile" lines say "(x86_64)"; there are no compiles for arm64.

I've never really understood what the "My Mac" thing is; thinking that that might be the problem, if I click that in my project window's title bar, the menu it shows has two choices: "My Mac" and "Any Mac (Intel)". There is no choice for "Universal" or some such. (But what is this setting anyway? Since my build settings say to build for "Standard architectures" and not "active architecture only", for a Release build, what does the "My Mac" setting govern?)

I'm left scratching my head. As far as I can tell, I'm doing everything Apple's page says to do, and yet I'm not getting an arm64 build – and that "Any Mac (Intel)" menu item suggests that my Xcode doesn't even know how to build for arm64, even though it is Xcode 12.1, which Apple says should know how to do it.

If I go to the Preferences and select Components, and click "Check and Install Now", things there seem to be up to date (but I think that's irrelevant anyway since my project is for macOS apps/tools, and does not involve any simulators). If I go to the Locations tab in prefs, it says "Command Line Tools: Xcode 12.1 (12A7403)".

What am I doing wrong??

Replies

(Oh, and "macOS 10.15" is the only macOS choice available under Base SDK, so I don't seem to have a choice regarding that setting.)
Aha. Apparently Apple's page is WRONG. Aargh. To build Universal you need to have Xcode 12.2 or later, not just Xcode 12. https://stackoverflow.com/questions/64466156/xcode-12-0-1-and-12-1-do-not-build-universal-applications
No was has replied to your question and maybe you solved it yourself, but I am having the same problem and the problem continues in XCode 12.2 (on Mac with 10.15.7). The problem is intermittent. I have three separate XCode projects. Two of them respond as expected. The third one, which seems to have the identical build settings, however, refuses to do an arm64 build. It is set for "Standard Architectures", but that setting is ignored and it does only x86_64 (and build active architecture only is set to "No"). Also, I get no error message explaining why it refuses to do the build.

Is there some other setting that could interfere with getting both builds? The one that fails is the oldest project, but I have updated the poject settings whenever recommended. If the build can't be done, it would be nice if XCode would explain why it was skipped?
  • Could you solve that? Having the same issue.

  • I have had the same issue. Forme it was that VALID_ARCHS was set to x86_64.

Add a Comment