xcode dyld:懒惰的符号绑定失败:无法解析符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20576421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:26:06  来源:igfitidea点击:

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

xcodemacosgitframeworkslinker

提问by user1855952

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/).

所以我一直在 XCode 中开发一个 c++ 项目,并且正在使用一个外部框架(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.

我最近决定将我的项目上传到 github,然后尝试在另一台 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.

我不知道这意味着什么,并且一直很难在网上找出问题所在。

回答by gaige

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.

该错误消息表明您正在链接一个共享库 ( dylib),当您执行它时,该共享库在运行时在库路径中不可用。

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.

如果您已将框架安装在/Library/Frameworks原始版本的标准位置之一(例如),并且安装在您检查和重建时的同一位置,那么您应该没问题。但是,框架链接存在一些复杂性,如果您不小心,可能会导致麻烦,尤其是当您使用嵌入式框架时。看起来您没有构建应用程序,所以我假设您没有嵌入框架。

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).

如果看起来它们在同一个地方,您可能需要检查DYLD_LIBRARY_PATH(关于dyld 的良好堆栈交换问题)。