【问题标题】:Unable to link IOKit driver against IOHIDFamily: "dependency load failed"无法将 IOKit 驱动程序链接到 IOHIDFamily:“依赖项加载失败”
【发布时间】:2019-12-17 23:30:47
【问题描述】:

我正在开发一个从 IOHIDFamily 扩展的 macOS IOKit 内核驱动程序,但是 xcode 给我链接错误,例如:

Allocating an object of abstract class type 'IOHIDDevice'

并且 kextload 给了我错误:

(libkern/kext) dependency load failed; check the system/kernel logs for errors or try kextutil(8).

如何正确链接到 IOHIDFamily 以修复这些错误,以便创建从 IOHIDFamily 类(如 IOHIDDevice)继承的类?

我已经将此添加到我的 Info.plist 中:

    <key>OSBundleLibraries</key>
    <dict>
        <key>com.apple.iokit.IOHIDFamily</key>
        <string>2.0</string>
        <key>com.apple.kpi.iokit</key>
        <string>17.7</string>
        <key>com.apple.kpi.libkern</key>
        <string>17.7</string>
        <key>com.apple.kpi.mach</key>
        <string>17.7</string>
    </dict>

这些是来自 kextload 的系统/内核日志:

Resetting IOCatalogue.
MacOS error: -67062
Kext with invalid signatured (-67062) allowed: <OSKext 0x7f99b7bf47c0 [0x7fff83ef4af0]> { URL = "file:///tmp/IOHIDTest.kext/", ID = "org.muirey03.driver.IOHIDTest" }
/tmp/IOHIDTest.kext is invalid; can't resolve dependencies.
org.muirey03.driver.IOHIDTest's dependencies failed security checks; failing.

任何帮助将不胜感激。

【问题讨论】:

  • @jvarela 这看起来不像是签名问题。 Kext with invalid signatured (-67062) allowed: 表示禁用 SIP,允许使用未签名的 kext。
  • @TommyMuir 正如kextload 的输出所示,您能否使用kextutil 重试加载kext?这提供了更具体的错误消息。
  • @TommyMuir "分配抽象类类型 'IOHIDDevice' 的对象" 为我敲响了一些警钟 - 你是否实现了所有超类的纯虚方法,例如 newReportDescriptor()?我假设您没有尝试直接创建 IOHIDDevice 本身的实例?如果有您不理解的错误,请发布确切的错误和导致错误的行以及任何相关上下文。
  • @TommyMuir 除了kextutil 的输出之外,kextlibs -undef-symbols -multdef-symbols -unsupported /tmp/IOHIDTest.kext 的输出也可能很有用,因此请将其添加到您的问题中。
  • @pmdj 你是对的。我不想实现newReportDescriptor 这是问题所在。感谢您的帮助。

标签: c++ macos kernel driver iokit


【解决方案1】:

事实证明,这个问题根本与链接无关。我没有在 IOHIDDevice 的子类上定义纯虚方法 newReportDescriptor,这使我的子类成为无法分配的抽象类。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多