Does Xcode 13.2 no longer create default.metallib for Framework targets, automatically?

Is anyone else seeing that Xcode 13.2 no longer creates a single default.metallib that combines all *.air files together? (Seeing this with a framework target, at least.)

Nothing in the release notes suggests this change... so for now a custom script like the following seems needed:

if [ ! -d "${METAL_LIBRARY_OUTPUT_DIR}"/default.metallib ]; then      xcrun -sdk macosx metallib "${TARGET_TEMP_DIR}"/Metal/*.air -o "${METAL_LIBRARY_OUTPUT_DIR}"/default.metallib fi;

Would be grateful to know if this is a bug or an intended change in the toolchain.

Thanks!

Hi, this sounds like a bug. Could you file a bug report on feedback assistant with a sample repro project? Also post the feedback ID here. Thanks!

I haven't had the time to file a bug yet, but this might help anyone else who bumps into this...

The problem seems to be triggered by the target being set to be deployed. I'm referring to the Build Settings whose xcconfig equivalents are DEPLOYMENT_LOCATION and INSTALL_PATH, e.g.:

DEPLOYMENT_LOCATION = YES

INSTALL_PATH = $(LOCAL_APPS_DIR)

The deployment location might also play a role, though this is speculation "inspired" by macOS security policies.

In our case, the framework whose default Metal library was not being created, was set up to be deployed to the Frameworks directory for the current user, i.e.

INSTALL_PATH = $(LOCAL_LIBRARY_DIR)/Frameworks

...and this is enough to trigger the failure.

This problem seems to affect more than just the Metal compiler. I noticed it too with the Storyboard compiler for a silly Swift app. Since the app was set to be deployed to $(LOCAL_APPS_DIR) the storyboardc invocation was failing to copy the compiled storyboard to the app bundle.

Whether this is a bug in recent versions of Xcode, or a side effect of these various tools being unable to touch files at those locations, the solution is to add built phases to "do what the underlying compiler is no longer doing" ;-)

Does Xcode 13.2 no longer create default.metallib for Framework targets, automatically?
 
 
Q