DriverKit target in iPad app, missing libclang_rt.profile_driverkit.a

I'm trying to build the DriverKit template driver target in an Xcode project which contains an app targeting iPadOS 17. I've made no modifications to the DriverKit template. When building, I get this link error

ld: file cannot be open()ed, errno=2 path=/Applications/Xcode 15.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.profile_driverkit.a in '/Applications/Xcode 15.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.profile_driverkit.a'

anyone know how to fix this? My search turned up something about building llvm from sources, which seems like overkill to put a DriverKit driver into an iPad app.

Accepted Reply

DTS (thank you Quinn!) helped me solve this.

The problem is a bug in Xcode's support for DriverKit in projects with a test plan (FB13381958). You have to go into the configuration of the test plan and disable Code Coverage for all targets. Disabling Code Coverage for the driver target only does not work .

Note that there's a code coverage setting in the target's Build Settings too, but changing that setting won't make the link error go away.

Replies

I had this exact issue.

Solution:

I tried every single possible thing to fix this and nothing at all worked. It was maddening-- I have NO IDEA what was proventing me from just embedding a new DriverKit driver target into my app-- I tried EVERYTHING possible, including re-installing Xcode completely, with a full purge and re-load, full reload of xcode-select --install as well.

The only thing that worked:

  • Create a new application target, embed / link the new DriverKit target to the new application target
  • Select every single file from the original project and add them all to the new application target using the Attribute Inspector
  • After adding all source code, manually update the new target's application info.plist, entitlements, etc.

After re-making the application target, this error stopped blocking me from compiling with the DriverKit driver.

I must underline though that literally everything I could possibly check between these two targets is configured identically. It still is, and it still doesn't work with the original app target, and does with the new one. This one cost me a few hours, but tbh it seems like it is just a troll in the machine.

TL;DR: This was solved (for me) by just starting over with a new application target.

**

Local Env

  • Application:
    • macOS application (Cocoa / AppKit, not Catalyst)
    • developed using a .xcworkspace so I can simultaneously work on a requried, private SPM Package
    • application has other OSS package dependencies, all incorporated by a mix of local forks and remote branches / releases
  • Macbook Pro, model Mac14,10, (M2 Pro, 16GB)
  • macOS Ventura 13.5.1 (22G90)
  • Xcode 15 (latest, and latest Swift version)
  • macOS app target version: 12.*^

I have published a fully working client sample app example that adds iPadOS support alongside macOS and updates to the latest driverkit version: https://github.com/DanBurkhardt/DriverKitUserClientSample

Should be immediately runnable, but you will have to ensure you disable SIP and enable developer mode, as per the original instructions (required without DriverKit entitlement permission from Apple). You will also need to change the bundle ID to your own name (replace "gigabitelabs" with something that is specific to your dev account / business).

DTS (thank you Quinn!) helped me solve this.

The problem is a bug in Xcode's support for DriverKit in projects with a test plan (FB13381958). You have to go into the configuration of the test plan and disable Code Coverage for all targets. Disabling Code Coverage for the driver target only does not work .

Note that there's a code coverage setting in the target's Build Settings too, but changing that setting won't make the link error go away.