Linker error building DEXT as part of app build, -fsanitize=undefined

I'm trying to make a DEXT target within my project. It compiles and links fine if I build just its own scheme. However, if I build my app's target, which includes the DEXT as a dependency, the build fails when linking the DEXT. The linker commands are different in the two cases. When built as part of the larger project, the DEXT linker command includes -fsanitize\=undefined. This flag is absent when I build using the DEXT's scheme alone. I searched the .pbxproj for "sanitize" - it doesn't appear, so it looks like Xcode is adding this flag.

The linker failure is this:

File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.ubsan_driverkit_dynamic.dylib

The only files with "driver kit" in their name in that directory are these two:

libclang_rt.cc_kext_driverkit.a

libclang_rt.driverkit.a

The successful link command includes this directive:

-lc++ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.driverkit.a

while the unsuccessful link command includes this one:

-lc++ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin/libclang_rt.ubsan_driverkit_dynamic.dylib

I tried adding -fno-sanitize=undefined to the OTHER_LINKER_FLAGS for the DEXT target, hoping that this would cancel the effect of the previous -fsanitize, but then I get undefined symbol errors:

Undefined symbol: ___ubsan_handle_shift_out_of_bounds

Undefined symbol: ___ubsan_handle_type_mismatch_v1

These appear to be referred to by the macros used in the iig magic.

I'm using Xcode 13.4.1 (13F100).

Does anyone know how I can fix this?

Linker error building DEXT as part of app build, -fsanitize=undefined
 
 
Q