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?
2
Answers
Try removing arm64 from the "Valid architecture" under the build setting of your Xcode project
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/orARCHS
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.
https://help.apple.com/xcode/mac/11.4/#/itcaec37c2a6
Set xcode "build setting" from terminal?
How do I print a list of "Build Settings" in Xcode project?
https://cmake.org/cmake/help/latest/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.html