I am on xcode 12.4 macOS catalina, Intel x64 machine. There is a project which is C/C++ project and outputs a dylib. In the xcode 12.4 the build setting "Architectures" is Apple Silicon & Intel.
Build active architecture Only is No.
The dylib builds fine but when I check if it is a Universal library or not using lipo then it shows on x64 and not arm.
2
Answers
I signed up just to post an answer, cause I spend couple of hours myself with the same problem.
There’s a setting ‘Allow Multi-Platform Builds’ under ‘Build Options’, that should be turned on. It did the trick for me and now it compiles a ‘fat’ dylib.
Confusing thing is that for the bundles, it compiles the universal binary with this setting turned to off, but not for the dylib’s.
I’ve just chased down my problem with a similar scenario, but with an application target. I had copied an FCPX project (created on Xcode v10.*) to a new project intended to support ‘arm64′ and
x86_64’. Since I was using *.xcconfig settings, I did not expect any problems – but, sure enough, arm64 was NOT built because of a "stray" setting for VALID_ARCHS that restricted the target to x86_64. But Xcode 12.2 no longer displays the "Valid Architectures" setting in the ui (this was the root of my confusion). At any rate, I fixed my issue first by adding a VALID_ARCHS setting (which included arm64) to the *.xcconfig file. The final solution was editing the project.pbxproj file, and discarding the VALID_ARCHS setting.