Osx_image xcode12.2 does not come with macos 11 SDK (no way to compile for ARM)

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.

Could you try using osx_image: xcode12u?

Tried that already. 100% same. No macos11 SDK inside.

$ xcrun --sdk macosx --show-sdk-path
/Applications/Xcode-12.for.macOS.Universal.Apps.beta.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk

Is this not what you want?

1 Like

Hi,

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.

2 Likes
Imprint