Xcode 在我添加库时出错:dyld: Library not loaded

Posted

技术标签:

【中文标题】Xcode 在我添加库时出错:dyld: Library not loaded【英文标题】:Xcode gives error when I add libraries: dyld: Library not loaded 【发布时间】:2021-04-11 20:37:10 【问题描述】:

首先我想在 xcode 中学习 SDL,但是当我尝试添加 SDL 框架时,会弹出此错误,我不明白为什么。我在互联网上看了 2 天,但找不到任何解决方案。 1 个月后(现在),我尝试将 GLFW 添加到 xcode,但这个错误再次让我感到困惑。为什么会出现这个错误?

dyld: Library not loaded: /usr/local/opt/glfw/lib/libglfw.3.dylib
  Referenced from: /Users/durdukolk/Library/Developer/Xcode/DerivedData/Graphic-dutmtfjytmmfetggltqeajfkggms/Build/Products/Debug/Graphic
  Reason: no suitable image found.  Did find:
    /usr/local/opt/glfw/lib/libglfw.3.dylib: code signature in (/usr/local/opt/glfw/lib/libglfw.3.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
    /usr/local/Cellar/glfw/3.3.4/lib/libglfw.3.3.dylib: code signature in (/usr/local/Cellar/glfw/3.3.4/lib/libglfw.3.3.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

【问题讨论】:

【参考方案1】:

我终于找到了解决方案。首先您需要在项目文件的签名部分中打开“启用强化运行时”。

并且需要在产品菜单中勾选“禁用库验证”。

更多详情:https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_disable-library-validation

【讨论】:

以上是关于Xcode 在我添加库时出错:dyld: Library not loaded的主要内容,如果未能解决你的问题,请参考以下文章

Xcode - dyld:库未加载

dyld:库未加载 Xcode11

Xcode 13 dyld:库未加载:/System/Library/Frameworks/LinkPresentation.framework/LinkPresentation

dyld:库未加载...原因:找不到合适的图像 Xcode Swift

在我的 React.js 应用程序中导入 D3.js 库时出错

[iOS Xcode8报错]dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserN