When I take a Debug Build of my macOS app, built in Xcode 9.1, and move it to a Mac running macOS 10.11 or 10.12 for testing, I find that my app's XPC process crashes on load, and the crash report indicates the cause is that the system cannot find the new sanitizer frameworks in the old system. OK, I understand these frameworks do not exist in older macOS versions. And, if I disable the Address Sanitizer, Thread Sanitizer and Undefined Behavior Sanitizer in the Run > Diagnosics section of the Scheme in Xcode, and rebuild, the problem is solved.
There are some things that don't make sense here. Why does the Run section of the Xcode Scheme apparently affect the Build? Why does only the XPC process crash?
Why does the Run section of the Xcode Scheme apparently affect the Build?
This indeed does not make sense but probly has a simple explanation. Older code diagnostic tools (API checker, malloc checker, etc.) didn't require recompilation so it made sense to put them into Run. Sanitizers are also diagnostic tools so developers decided it's better put them in the same menu and force people to rebuild app.
Why does only the XPC process crash?
I'm guessing here but Asan initialization is typically quite involved and in particular may happen after other libraries are initialized. It might be that main process started XPC child before initializing Asan.