c++xcodeaddress-sanitizer

xcodebuild ASAN doesn't work with custom CC/CXX/LD/LDPLUSPLUS variables


While trying to build XCode project with xcodebuild -enableAddressSanitizer I encounter one of the following errors.

  1. Could not get lib darwin path
  2. Unable to copy Address Sanitizer library

I use ccache so my CC/CXX/LD/LDPLUSPLUS is overriden in XCode project settings.


Solution

  • XCode (as of 15.2 and 15.4) doesn't support AddressSanitizer with custom CXX/CC variable.

    The only working solution is to remove CC/CXX/LD/LDPLUSPLUS and use stock AppleClang.