Xcode 11 beta simulator crashes when trying to load AudioToolbox - xcode11

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.

Related

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~

Unity project. Undefined symbols for architecture armv7

I make a build for iPhone for the first time and got a problem.
I already checked a lot of posts and didnt find answer.
When i make a build on device a get:
Undefined symbols for architecture armv7:
"RegisterAllStrippedInternalCalls()", referenced from:
RegisterAllInternalCalls() in libiPhone-lib.a(MonoICallRegistration.o)
"RegisterAllClasses()", referenced from:
InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)
"RegisterMonoModules()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On simulator ok.
libiPhone-lib.a added to link libraries.
Can somebody tell what it is? Please
Your unity version is not compatible, just download the latest version of unity which I believe is 4.3.1 and try recompiling. Here is the link if you need it. http://unity3d.com/unity/download/download-mac
The new version is compatible with armv7.
ok if anyone else is experiencing the same problem here's a way out:
those 3 methods mentioned are declared in the RegisterMonoModules.cpp in the Libraries folder, usually. so take that cpp file and add it to your target's Build Phases > Compile Sources
then if you have additional SDK's integrated that are not added to the 'Compile Sources' the new build will throw some other errors. just make sure to add the wrapper .mm files from the sdk's to your Compile Sources. Usually one .mm file per sdk. (e.g. for unity facebook sdk it's FbUnityInterface.mm file)
hope this helps

Symbol not found: _objc_release with IOS 4.3 Simulator

UPDATE: please leave a comment when you have this working without problems on your system. That would confirm that this is a problem in my setup, rather than a bug in XCode.
After upgrading my development system to XCode 4.5.1, and compiling with IOS SDK 6.0, I get the following errors when running on the IOS 4.3 simulator:
dyld: lazy symbol binding failed: Symbol not found: _objc_release
Referenced from: /Users/baraupp/Library/Application Support/iPhone Simulator/4.3.2/Applications/AFD73AB4-7047-468B-A20B-9C941850ED3C/Flyskyhy.app/Flyskyhy
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation
dyld: Symbol not found: _objc_release
Referenced from: /Users/baraupp/Library/Application Support/iPhone Simulator/4.3.2/Applications/AFD73AB4-7047-468B-A20B-9C941850ED3C/Flyskyhy.app/Flyskyhy
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation
I have set the deployment target to 4.3, and I use ARC in the project, with some files on -fno-objc-arc. Compiling and linking succeeds without errors, it fails when trying to run on the simulator. It used to work fine before I upgraded.
EDIT:
I found a similar Stackoverflow question that asks almost exactly the same thing, and its answer suggests adding -fobjc-arc to the other linker flags. Unfortunately, that did not solve my problem. EDIT: I checked the flags that are actually used in the link phase, and the -fobjc-arc flag is present while linking, also without me adding -fobjc-arc explicitly.
As suggested by Brad in the comments, I added the library libarclite_iphoneos.a to the project, but that did not help either. I found that library in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc, which is a weird location in my view, but I could not find it anywhere else.
I also did 'nm' on that library, and it does not define the missing _objc_retain symbol either. It does define a _objc_retain$non_lazy_ptr, though, not sure what that means.
EDIT: I found out that the library gets ignored:
ld: warning: ignoring file libarclite_iphoneos.a, missing required architecture i386 in file libarclite_iphoneos.a
So obviously, it is not the correct file. But I cannot find the same file anywhere else on my system (I have searched with 'find').
Any ideas?
The problem was triggered by a +initialize method in a class category. Apparently, the Apple linker does not handle that case correctly.
After searching the web a lot, I saw that other people also have had issues with +load and +initialize methods, ARC and 4.3 compatibility.
In my case, I initialized a static variable in a category as such:
#implementation NSDictionary (FormAccess)
static NSRegularExpression *pattern;
+ (void) initialize
{
pattern = [[NSRegularExpression alloc] initWithPattern:#"(\\w+)|\\[([0-9]+)\\]" options:0 error:nil];
}
...
#end
The problem disappeared when I replaced that with an explicit initialization the first time the variable was used. I did not need to add any linker flags.
Note that if you have a non-ARC project that uses some ARC files, you still need to add the "-fobjc-arc" flag to "Other Linker Flags", to avoid the same error message.

Darn linker errors XCode 4.3--algorithm to solve them?

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AppDelegate_Shared", referenced from:
_OBJC_CLASS_$_AppDelegate_iPad in AppDelegate_iPad.o
"_OBJC_METACLASS_$_AppDelegate_Shared", referenced from:
_OBJC_METACLASS_$_AppDelegate_iPad in AppDelegate_iPad.o ld: symbol(s) not found for architecture i386 clang: error: linker command
failed with exit code 1 (use -v to see invocation)
Hello, this is a straight up AppDelegate, and I'm getting this error. Any ideas? There's no library to link to or anything. I've seen these errors time and time again in XCode, but the causes have ranged from a libxml2 library being not right (needed libxml2.7.3), to just something odd in XCode itself. No idea what to do next, but obviously would like the program to compile. Thanks!
same here. thanks for the answer.
I had just (literally 30 seconds ago) dragged the files in.
I used the same files in other projects no problem.
got this linker error (updated to XCode 4.3 yesterday)
and same problem, the .m file was checked for the Test target membership, but NOT the app target.
possibly a 4.3 bug. it seems it is defaulting to adding dragged in files to the test build and not the app build.
thanks... you helped me find it very fast. I was not looking forward to that.

Resources