Address Sanitizer doesn't compile with an app with DriverKit target

26 Views Asked by At

We got an iOS app with two targets, the main target and an DriverKit extension target.

If I want to activate the Address Sanitizer in the scheme for the main app:

AddressSanitizerEnabled

I would get an error:

File cannot be open()ed, errno=2 path=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.asan_driverkit_dynamic.dylib in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.asan_driverkit_dynamic.dylib'

I assume this is because driverkit doesn't allow Address Sanitizer, because if I remove the DriverExtension target, the app will compile just fine.

I think I could set up manually the Address Sanitizer with this compiler flag:

-fsanitize=address

I wonder if there is way using the compiler flags manually in the Building settings so I can set up the Address Sanitizer only for the main target but not for the extension.

Would this be possible or would this run into other problems?

0

There are 0 best solutions below