xcode build error: Could not find path to clang binary to locate Address Sanitizer library

When I have the Address Sanitizer option turned off in Xcode(version 15.3), the project builds successfully. However, as soon as I enable the option, the build fails with the error message: 'Could not find path to clang binary to locate Address Sanitizer library.'

I found libclang_rt.asan_ios_dynamic.dylib in the Xcode directory and added it to the build Phases -> Link Library with Libraries. However, I still get the same error. But when I create a new project and enable the Address Sanitizer option, it builds successfully.

Replies

But when I create a new project and enable the Address Sanitizer option, it builds successfully.

This is key. It means that your Xcode setup is fine, and thus the problem is tied to the settings in your project. I recommend that you survey the build settings in your project to see what’s different from your working test project.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"