I am using Xcode 15.2 Beta on macOS Sonoma 14.3 Beta with the macOS Sonoma 14.2 SDK. Similarly to post 702244
, I am trying to build the same exact repository, partially for my own education. The issue I am running into is that one of the files references IOKit/hid/IOHIDDevice.h
, which, in turn, references IOKit/IOReporter.h
. Since both of these are searched for, with #include <…>
, in a base path of Kernel.framework/Versions/A/Headers
, it follows that there should at least be a file somewhere in that folder called IOReporter.h
, but there is not. There isn't even a copy in IOKit.framework/Versions/A/Headers
, although that folder has another version of hid/IOHIDDevice.h
entirely, which does not reference a IOReporter.h
file. Is the lack of an IOReporter.h
file deliberate, accidental, or is the mere continued existence of a kernel-space IOKit IOHIDDevice.h
, containing a deprecated kernel-space IOHIDDevice symbol, an accident; possibly a simple hold-over from a previous version? Is there a way to make this compile? Am I missing anything? Should it be assumed that deprecated kernel-mode APIs will simply not compile?
Using Deprecated Kernel-Space IOKit Symbol IOHIDDevice via Kernel.framework-provided Headers
I was going to ask you to try reproducing this on released software, but it turns out I was able to do that:
-
Using Xcode 15.1, create a new project from the macOS > IOKit Driver template.
-
Add the following to the
.cpp
file:#include <IOKit/IOService.h>
-
Choose Product > Build; it should build fine.
-
Now add this:
#include <IOKit/hid/IOHIDDevice.h>
It fails with the error …/IOHIDDevice.h:37:10 'IOKit/IOReporter.h' file not found
.
This is clearly a bug in the KDK and I recommend that you file it as such. Please post your bug number, just for the record.
You can get this to build by hacking up your own copy of the IOReporter
declarations:
-
At the top of your project, add a file
Hack/IOKit/IOReporter.h
. -
Change the System Header Search Paths build setting to two items:
$(SRCROOT)/Hack
and$(inherited)
. -
Set the contents of the file to this:
#ifndef IOReporter_h
#define IOReporter_h
#include <IOKit/IOReportTypes.h>
class IOReporter : public OSObject { };
class IOSimpleReporter : public IOReporter { };
#endif /* IOReporter_h */
I can’t promise that this code will actually run, but at least it builds so that you can continue your explorations.
WARNING Do not ship a product based on this hack.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"