dyld: lazy symbol binding failed: can't resolve symbol - xcode

So I've been working on a c++ project in XCode and am making use of an external framework (SFML http://www.sfml-dev.org/ ).
I recently decided to upload my project to github and then tried checking out the project on another Mac.
However, when I try to run my program on the new computer, I get this error
dyld: lazy symbol binding failed: can't resolve symbol __ZN2sf5ImageC1Ev in
/Users/myname/Library/Developer/Xcode/DerivedData/projectname-
fufhzxbkoeekzeayzzlrtvgajvnn/Build/Products/Debug/projectname because dependent
dylib #3 could not be loaded
I have no idea what this means and have been having a hard time finding out online what exactly the issue is.

That error message indicates that you are linking against a Shared Library (dylib) which is not available in the library path at run time when you are executing it.
If you have installed the framework in one of the standard locations (such as /Library/Frameworks) on your original build and in the same place when you checked it your and rebuilt, then you should be OK. However, there are some complexities to framework linking that can cause trouble if you are not careful, especially if you use embedded frameworks. It looks like you are not building an application, so I assume you're not embedding the framework.
Compare the installation locations of your frameworks on both the new and old computer and if they are not the same, that's likely your problem.
If things look like they are in the same place, you may need to check the DYLD_LIBRARY_PATH (good stack exchange question about dyld).

Related

UnityPlayer_UAP_ARM64_release_il2cpp.pdb not loaded

I've installed several packages in a Unity (2020) app I'm building. Namely: World Locking Tools, MRTK, PUN2. World Locking Tools provides some examples that are built with assemblies defining scripting symbols that any derived files I want to build would need access to. I'd like to create my own version of certain files from one of these examples. To do this and have access to the scripting symbols in one of those examples, I created an assembly reference to reference the assembly for that example code within World Locking Tools package installed in my project space. In so doing, I kept running into the common "...not found, are you missing an assembly reference" issue, which ultimately led me to creating assembly references for many of the assemblies provided by the various packages I needed to use (not just the particular example code I initially wanted to modify). Once my project finally built successfully in unity, I then tried to upload to a Hololens 2 headset in Visual Studio. This provided the error in the title of this post. Coincidentally, the app also appears to fail to start on the headset. Before I tried to alter my codebase with modified versions of files from that World Locking Tools example and with assembly references, the code would successfully build in Unity and successfully deploy to the Hololens 2 headset.
Does the behavior and missing .pdb error I describe mean that I'm missing assembly references for yet other packages even though Unity successfully builds the project?
This is my first foray into using assemblies so be please be gentle :)
For the .pdb message, that one is ignorable since will not have that symbol available. However, the app not starting is definitely likely due to a missing component or loading issue. When ran in debugger, may get a better idea on what is missing or from a debugger log in Unity.

XCode 7 / Cordova plugin / Link issue: _utf8_nextCharSafeBody undefined symbol

I'm adapting an (apparently outdated) Cordova plugin for use in my app (PhoneRTC if you're curious).
As a Linux/CLI guy at heart I've been struggling with XCode for a day, and I managed to iron out most of the deprecated code using a lot of Google and some blind guessing. However, now I'm stuck with a final error during the linking phase:
"Undefined symbols for architechture arm64: "_utf8_nextCharSafeBody", referenced from: [snip]"
The plugin's original installation instructions mention linking the binary to the library libicucore.dylib, but this seems to have been removed in the latest XCode (there are references of the same name with .tbh extensions available but these aren't valid for that dialog - even though I can select them, but whatever).
Some more Googling offered suggestions for linking various *.frameworks instead, but to no avail - the error remains.
Does anyone have any idea what I need to link to to make this function available? Or if it's permanently removed I'd also like to know, although that would involve rebuilding the binaries which wouldn't be something I'm looking forward to...
Or if you don't know, would there be a way to grep through Apple's libraries somehow to see which one is supposed to be defining a missing symbol?
(Needless to say, IF I can get this working it's going to be forked from the original repo and donated back to the community :))
So, I'm not sure what I changed exactly, but suddenly I could add libicucore.tbh as a linked library. I probably changed the build target or something, but in any case the linking error disappeared (to be replaced by a signing error because XCode, but that I can solve).

Why do I have to embed my libraries inside my applications binary for them to work?

So I followed this tutorial:
http://locomoviles.com/ios-tutorials/create-ios-cocoa-touch-framework-using-xcode/
Everything went fine except when I went to run the program I got the following error:
> dyld: Library not loaded:
> #rpath/SwiftFramework.framework/SwiftFramework Referenced from:
> /Users/bluke/Library/Developer/CoreSimulator/Devices/40677D10-F22B-4AE4-B767-06439AB7887A/data/Containers/Bundle/Application/8C6A5F76-C666-4B69-9353-A0ABD7DA085B/UseFramework.app/UseFramework
> Reason: image not found
I was able to solve this problem by adding the framework as an embedded binary, but I don't understand why this was needed to solve the problem.
I thought that the framework would be included in my application bundle as a dynamically linked library (i.e. not embedded in my application's binary directly) and then linked at run time. Is this assumption incorrect?
Just in case my question was unclear, I've added the following pictures.
This is what was producing the error:
If I add the framework to the embedded binaries it works:
I thought that the framework would be included in my application
bundle as a dynamically linked library (i.e. not embedded in my
application's binary directly) and then linked at run time. Is this
assumption incorrect?
Yes, it's incorrect. iOS apps link 3rd party frameworks statically, not dynamically. This prevents apps from downloading and dynamically linking code that hasn't been vetted by the app store review process.
This allows apps coded in Swift to run on devices running a version of iOS pre-dating Swift (earlier than iOS8).
Non-Apple frameworks can be embedded on iOS8 and above only.
It is also nice to add a prefix the the name identifying the developer organization so as to avoid comflicts and confusion. "SwiftFramework" looks so much like an Apple framework.

How do I add Gosu framework for XCode4 project?

I have little to no knowledge about linking and referencing files/resources when it comes to compiled languages (I'm a Ruby programmer).
I'm trying my best using general tutorials on "how to add a framework to XCode 4 project", but I'm having a rough time trying to understand how am I supposed to do this, as everything I do fails in the end.
I've simply created a new cocoa application, went to build phases / Link Binary With Libraries and added Gosu.framework there. I didn't do anything else.
Now when I try to run the application, I get this error:
dyld: Library not loaded: #executable_path/../Frameworks/Gosu.framework/Versions/A/Gosu
Referenced from: /Users/ellmo/Library/Developer/Xcode/DerivedData/gosuTest-hkmqdspnwjepredgslldpnmuhlvx/Build/Products/Debug/gosuTest.app/Contents/MacOS/gosuTest
Reason: image not found
What should I do?

How do I solve a "dyld: Library not loaded:" error in Xcode 4 unit tests?

I have an Xcode 4 project, a Cocoa application with Spotlight, Core Data and unit tests. The app uses a custom framework named TBPluginManager I wrote to load bundles. I originally wrote the framework in Xcode 3 but when I used it in Xcode 4 GDB kept complaining, so I recreated the framework in Xcode 4. This made GDB happy, until I tried to run the built-in unit-test and got:
[Switching to process 3840 thread 0x0]
dyld: Library not loaded: > Library/Frameworks/TBPluginManager.framework/Versions/A/TBPluginManager
Referenced from: /Users/elise/Library/Developer/Xcode/DerivedData/BookManager-cooglmktssmptpatjuetculukiqd/Build/Products/Release/BookManager.app/Contents/MacOS/BookManager
Reason: image not found
sharedlibrary apply-load-rules all
No memory available to program now: unsafe to call malloc
Now I can understand why the unit test cannot find the framework since it lives not at Library/Frameworks/TBPluginManager.framework but at /Library/Frameworks/TBPluginManager.framework. But how do I tell that to the unit-test bundle? I've tried setting the Framework, Header and Library Search path build setting, but to no avail.
BTW, I've gone back to GHUnit but I'd like to get this working as well.
FOLLOW-UP: Much as it bugs me that Grady Player got an account just to tell me that I'm an idiot, it just may be that he or she is right. My lovely, dependable framework is generating warnings and errors like they're going out of fashion and so I've turned the problem over to Apple Developer Technical Support. If anything interesting comes out of it, I'll post it here. Otherwise, I'll delete the question.
make sure that the framework installed at /Library/Frameworks/TBPluginManager.framework is valid and the same arch as you are trying to link it to. If you are in doubt recompile the framework again, put it in a custom location and set that custom location in your framework search path.

Resources