dispatch/block.h not found

This is definitely a weird one -- the laptop is running macOS 12, but it's trying to build using macOS 13 SDK? (The machine cannot run anything later than macOS 12, btw.)

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/dispatch/dispatch.h:69:10: fatal error: 
      'dispatch/block.h' file not found
#include <dispatch/block.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.

I'm trying xcode-select --install but has anyone run into this before?

And yes, that seems to have fixed it. It's still very weird.

dispatch/block.h not found
 
 
Q