XCode - Library cannot be inserted libclang_rt.asan_ios_dynamic.dylib - xcode

After updating to Xcode 11.4 suddenly the following error is being thrown from the debugger when my application begins running on a physical iPhone connected to Xcode.
dyld: warning: could not load inserted library '#executable_path/Frameworks/libclang_rt.asan_ios_dynamic.dylib' into hardened process because no suitable image found. Did find:
/private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib: code signature invalid for '/private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib'
/private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib: code signature invalid for '/private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib'
/private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib: stat() failed with errno=1
dyld: Library not loaded: #rpath/libclang_rt.asan_ios_dynamic.dylib
Referenced from: /private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/HeadPop!
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib: code signature invalid for '/private/var/containers/Bundle/Application/40EE2455-9E2E-4259-A997-F439F67E9CE5/sample-app!.app/Frameworks/libclang_rt.asan_ios_dynamic.dylib'
Can anyone please explain to me what this library libclang_rt.asan_ios_dynamic.dylib is ?
And how to recover from this issue?

In my case the exception (in Xcode 11.4) was:
dyld: could not load inserted library '.../Build/Products/Debug-iphonesimulator/MyApp.app/PlugIns/UnitTests.xctest/Frameworks/libclang_rt.asan_iossim_dynamic.dylib' because image not found
And the clue in a comment above is right: the issue was caused by thread_sanitizer: true in fastlane configuration for 13.4.1 device. Same flag for 12.4 device did not cause any problem.
I didn't find a better solution than removing this flag.

I also had this issue with the "Undefined Behavior Sanitizer" checked. Seems like this may occur with any sanitizer. Unchecking resolved the issue.
Find the Sanitizer checkboxes in Product > Scheme > Edit Scheme > Run > Diagnostics

Related

Xcode 11 beta simulator crashes when trying to load AudioToolbox

I'm trying to run an existing application to see how well it works with the latest Xcode beta and to try to use SwiftUI in an existing project. When I run the project on Simulator I get the following run-time crash:
dyld: Symbol not found: __ZTISt11logic_error
Referenced from: /Users/lucas/Library/Developer/CoreSimulator/Devices/224333CF-0388-4F57-9633-6CAB37B33510/data/Containers/Bundle/Application/<Guid>/<AppName>.app/<AppName>
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
in /Users/<name>/Library/Developer/CoreSimulator/Devices/224333CF-0388-4F57-9633-6CAB37B33510/data/Containers/Bundle/Application/<Guid>/<AppName>.app/<AppName>
Setting everything to iOS 13 made the error go away but that won't work in the near future. Also tried to remove anything related to Audio and AV frameworks but that didn't help.
Apparently same bug, but with different symbol:
dyld: Symbol not found: __ZTISt9bad_alloc
Referenced from: <bla-bla-bla>
Expected in: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.1.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
in <bla-bla-bla>
#Jeremy's answer worked for me. To help find it, the file is at
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox.tbd
and the lines you take out are:
weak-def-symbols: [ __ZTI11CAException, __ZTIN8DSPGraph9ExceptionE, __ZTINSt3__112bad_weak_ptrE,
__ZTINSt3__117bad_function_callE, __ZTISt11logic_error, __ZTISt12length_error,
__ZTISt12out_of_range, __ZTISt13runtime_error, __ZTISt16invalid_argument,
__ZTISt18bad_variant_access, __ZTISt8bad_cast, __ZTISt9bad_alloc,
__ZTISt9exception, __ZTS11CAException, __ZTSN8DSPGraph9ExceptionE,
__ZTSNSt3__112bad_weak_ptrE, __ZTSNSt3__117bad_function_callE,
__ZTSSt11logic_error, __ZTSSt12length_error, __ZTSSt12out_of_range,
__ZTSSt13runtime_error, __ZTSSt16invalid_argument, __ZTSSt18bad_variant_access,
__ZTSSt8bad_cast, __ZTSSt9bad_alloc, __ZTSSt9exception ]
This is a bug in the iOS 13 Beta SDK. You can hack around it by editing the AudioToolbox.tbd file within the SDK to remove the __ZTISt11logic_error (et al) symbols that shouldn't have been exported from there, or you can edit your link line to include -lc++ before -framework AudioToolbox (such that the static linker uses the correct references in libc++ rather than the once that were incorrectly referenced from AudioToolbox).
Or you can wait for a future beta with the fix ;)
I had crash with quite same error:
dyld: Symbol not found: __ZTISt11logic_error
Referenced from: <bla-bla-bla>
Expected in: /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
in <bla-bla-bla>
But I faced it when I was compiling own C++ project in Clion, so nothing linked with Simulator or iOs.
At that time I had XCode 10.2.1. I have tried multiple stuff to fix this crash, but nothing helped.
Luckily I found this post, so I downgraded my XCode to 10.1 and it's Command Line Tools. And it helped me!
So, even if my advice may not help with XCode 11 beta, I hope it can help other developers with the same error as you have.
This is an Xcode bug, but with a work-around. In your target's "Frameworks Libraries & Embedded Content" section, add libc++.tbd and make sure it's the at the top of the list. That should be all your need.

dyId: Symbol not found: _clock_gettime

I am trying to execute a python code using PyPy2 v5.10 on MacOS El Capitan 10.11.6. However, I keep getting this error during runtime.
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
Referenced from: /Users/macpro/Downloads/pypy2-v5.10.0-osx64/bin//libpypy-c.dylib
Expected in: flat namespace
dyld: Symbol not found: _clock_gettime
Referenced from: /Users/macpro/Downloads/pypy2-v5.10.0-osx64/bin//libpypy-c.dylib
Expected in: flat namespace
fish: './pypy contactTrace.py' terminated by signal SIGTRAP (Trace or breakpoint trap)
I have read from a few sources that its because El Capitan does not implement the clock but delcares it. Hence, one solution is to upgrade the software or comment out the declaration. Upgrading the software is not an option for me because I have a lot of other scripts running in that particular computer. I was trying to comment out the declaration but I am unable to find where I can comment it off. Also, will it really solve the issue? Or are there any more simpler solutions to it. I am not very familiar with the MacOS platform and am only using it for this project.
Thanks in advance!
That sounds like a wrongly linked libSystem.dylib, and that will be hard to fix (e.g. checking libs with otool and modifying lib with install_name_tool). However, there are newer versions of PyPy. Do you have tried them?

XCode 8.3 OpenGL linker error: Library not loaded

The GLFW library runs fine in an older project (created in XCode 7.x). I used the same method to add library directory and includes files, but this time it prompts a run time error, the error message is:
dyld: Library not loaded: lib/libglfw.3.dylib
Referenced from: /Users/BlacKay/Documents/Projects/OpenGL Tutorials/OpenGL_tutorial_anton/build/Debug/Learn_OpenGL
Reason: image not found
Program ended with exit code: 9
If someone can point what the potential problem is, that'd be great. Thanks~

XCode - Linker failed

I have been given an xcode project and I am trying to compile and getting the following error:
ld: library not found for -lAFNetworking
I have looked inside \Pods and there is a folder there called AFNetworking
I can't see what the issue is, or how to fix this. Can anyone guide me to how to fix this issue?

Executable path error in xcode 4.2

I am building a command line tool .I have added Flac.framework in my xcode project and I am running it for 32 bit mac. But It is giving error after running
dyld: Library not loaded:
#executable_path/../Frameworks/FLAC.framework/Versions/A/FLAC
Referenced from:
/Users/Library/Developer/Xcode/DerivedData/Flac_decoder-dbwsvotpcvjmwceheldbxndflbig/Build/Products/Debug/Flac_decoder
Reason: image not found
I have included Header search Path and framework path and still giving error. How to resolve this ?

Resources