Xcode injects bogus path to libclang_rt.asan_osx_dynamic.dylib

Originator:stheophil
Number:rdar://29042158 Date Originated:
Status:Open Resolved:
Product:Xcode Product Version:8.1
Classification: Reproducible:Yes
 
Summary:
We develop a shared library and compile our library with enabled AddressSanitizer. The executable that loads our library is not developed by us. When I try to debug the executable, I get the error message 

dyld: could not load inserted library '@executable_path/../Frameworks/libclang_rt.asan_osx_dynamic.dylib' because image not found

I see that DYLD_INSERT_LIBRARIES=@executable_path/../Frameworks/libclang_rt.asan_osx_dynamic.dylib:/Applications/Xcode8.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode8.app/Contents/PlugIns/../Developer/Platforms/MacOSX.platform/Developer/Library/Debugger/libViewDebuggerSupport.dylib

Steps to Reproduce:
1. Enable "AddressSanitizer" in current Scheme
2. Under Environment Variables in Scheme add "DYLD_PRINT_LIBRARIES"
3. Compile and run application

Expected Results:
The application should start.

Actual Results:
The application does not start. DYLD_PRINT_LIBRARIES shows that Xcode set the variable DYLD_INSERT_LIBRARIES to @executable_path/../Frameworks/libclang_rt.asan_osx_dynamic.dylib which is incorrent. 

Version:
Xcode 8.1

Notes:
As a workaround, I set the environment variable 

DYLD_INSERT_LIBRARIES=/Applications/Xcode8.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib

that fixes the issue

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!