Error building kernel extension on Xcode 13.3.1

I have just installed the latest Xcode (13.3.1) and am finding that when I attempt to build a kernel extension (which was compiling fine in 13.2.1) I encounter the following error:

 error: use of undeclared identifier '__APPLE_CC__'

This appears to be inside an auto-generated file named <TargetName>_info.c, located in ../Intermediates.noindex/<ProjectName>.build/Debug/<TargetName>.build/DerivedSources/

I couldn't see any reference to this change in the release notes for Xcode 13.3 or 13.3.1.

From some reading it appears that __APPLE_CC__ is related to a C compiler version.

Has anyone else encountered this or know whether this is a bug, or part of the deprecation of kernel extensions?

Many thanks

Replies

The first step in debugging problems like this is to determine whether the issue is tied to your environment or your project. If you create a new project from one of the built-in templates — macOS > Generic Kernel Extension or macOS > IOKit Driver, depending on what type of KEXT you’re working on — does it have the same issue?

Share and Enjoy

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