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
^
I want to compile using command line tools (not xcode by itself). Therefor a component named “Command Line Tools for Xcode 12.2” needs to be installed. This will setup the SDK into the well known folder: “/Library/Developer/CommandLineTools/SDKs”.
The current osx_images with xcode 12 seems to contain incomplete setups (of pre releases?) of Xcode 12.
On a fresh local macos and an installation of the release version of XCode 12.2 + “Command Line Tools for Xcode 12.2” : ( on shell execute “xcode-select --install” (will popup a UI dialog to accept license) I can see the macos11 SDK in the “/Library/Developer/CommandLineTools/SDKs” folder and compilation is working fine.
When not able to use its default SDK, clang seems to fall back automatically on /Applications/Xcode-12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk