Cmake and ninja still referencing old SDK after upgrading to XCode command line tools 14.3.1

I was on 14.3 and building my project fine. After upgrading to XCode command line tools 14.3.1 (MacOS SDK 13.3), I'm unable to build my project any more:

/Library/Developer/CommandLineTools/usr/bin/make build BUILD_DIR=debug -j 16
cmake --build _build/debug -j 16
ninja: error: '/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/lib/libz.tbd', needed by 'project1', missing and no known rule to make it
make[1]: *** [build] Error 1
make: *** [debug] Error 2

NOte that the error message shows it's looking for libz.tbd still under the old SDK MacOSX13.1.sdk, while the just installed version is MacOSX13.3.sdk

$ ls -lht /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/libz.tbd
lrwxr-xr-x  1 root  wheel    10B Jun 11 21:29 /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/libz.tbd -> libz.1.tbd

Reinstalling cmake and ninja didn't help.

I also tried reverting to the previous veresion by downloading and installing XCode command line tools 14.3, but then even more problems were found that many tools/libs were referring to MacOSX13.3.sdk instead of MacOSX13.1.sdk and reinstalling them didn't help.

Can someone help please?

On Apple platforms the SDK is revlocked to the tools. We do not support mixing and matching. For example, the Xcode 14 tools only work with the macOS 13 SDK.

As to what’s going on here, it’s hard to say. I recommend that you start by verifying that your tools are set up correctly. Specifically:

  1. Use xcode-select to select the tools you want to use.

  2. Compile a tiny test program, using clang directly, to make sure it’s able to find the SDK.

If that works then the next step is to determine which your third-party build system isn’t picking up the currently selected tools and SDK. That’s not something I can help you with, alas. I don’t maintain expertise in third-party tooling.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

If using cmake, remove the cmake generated temporary files / directories. Then rerun the cmake command and then run the build command (either make or ninja).

I have the exact same issue (also with libz.tbd), but after upgrading Xcode from 14 to 15 today. CMake and ninja are still referring to the 13.3 SDK, but this does not exist anymore. As a temporary fix, I removed Xcode and the command line tools completely and reinstalled Xcode 14 (before, I used Xcode from the App Store, which updated itself automatically). I can now compile my project again, but this does not feel like a fix for the problem.

Cmake and ninja still referencing old SDK after upgrading to XCode command line tools 14.3.1
 
 
Q