2

In Xcode 12, the default architecture for building got changed to arm64. This causes many things to not build.

In this instance, running pip install psutil fails to build with an "architecture not supported error".

How can I change the default build architecture for xcode 12?

cclloyd
  • 8,171
  • 16
  • 57
  • 104

2 Answers2

0

Try removing arm64 from the "Valid architecture" under the build setting of your Xcode project

Supported screenshot

Arsenic
  • 727
  • 1
  • 8
  • 22
  • 1
    I mean without any project, since this affects things outside of xcode projects. – cclloyd Oct 19 '20 at 05:04
  • there seems to be no other way right now. This is also an active issue on the [psutil's github repo](https://github.com/giampaolo/psutil/issues/1832) – Arsenic Oct 19 '20 at 05:13
0

There are two ways:

xcodebuild -arch

If you have a folder with .xcodeproj file in it, you can run xcodebuild -arch architecture <other options> to use a particular arch.

Xcode build settings.

Use VALID_ARCHS and/or ARCHS environment variables to let Xcode use those settings.

It can be set via CMAKE_XCODE_ATTRIBUTE_* also.

There are several undocumented variables also, which you can find by running xcodebuild -showBuildSettings or adding a post build script with a no-op command, and show env vars in build log ticked.

If either of them has the bad arch set, just overwrite it.

puio
  • 1,208
  • 6
  • 19