I try to build “universal” binary with XCode 12.2 osx_image but it looks like the correct SDK is missing.
Here a “ls” run from inside of the osx_image:
$ ls -al /Library/Developer/CommandLineTools/SDKs
drwxr-xr-x 5 root wheel 160 May 5 2020 .
drwxr-xr-x 5 root wheel 160 Feb 11 2020 ..
lrwxr-xr-x 1 root wheel 15 May 5 2020 MacOSX.sdk -> MacOSX10.15.sdk
drwxr-xr-x 7 root wheel 224 May 5 2020 MacOSX10.14.sdk
drwxr-xr-x 8 root wheel 256 May 5 2020 MacOSX10.15.sdk
Only MacOSX10.15 and MacOSX10.14 SDK is installed (default pointing to 10.15).
When I try to compile something for ARM (apple silicon) I get errors from SDK telling me that the architecture is not supported (of course MacOSX10.15 SDK only supports 386 and x86_64):
...
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:68:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
^
You need to add “-target arm64-apple-macos11” to CFLAGS to compile ARM64 on command line (according to apple documentation: https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary )
EDIT: Looks like installation of “Command Line Tools for Xcode 12.2” is missing in this image. Right now just an older version is present.