简体   繁体   English

“库未加载:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib”与 Xcode 8?

[英]"Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib" with Xcode 8?

My project requires OpenSSL libraries crypto and ssl .我的项目需要 OpenSSL 库cryptossl After updating Xcode to 8.2.1, compiling my project fails.将 Xcode 更新到 8.2.1 后,编译我的项目失败。

In my project Build Settings, in Linking , I have -lssl -lcrypto -lxml2 that indicates to load those libraries.在我的项目 Build Settings 的Linking中,我有-lssl -lcrypto -lxml2表示加载这些库。 Going back to my app Build Settings, I add /usr/local/opt/openssl/lib/ in the Library Search Paths to tell Xcode where to look.回到我的应用程序构建设置,我在库搜索路径中添加/usr/local/opt/openssl/lib/以告诉 Xcode 在哪里查找。

Hurray, it compiles, builds and run properly.万岁,它可以正确编译、构建和运行。 Cool.凉爽的。

BUT

When launching the app on a different mac, the app crashes, with this linking error:在不同的 Mac 上启动应用程序时,应用程序崩溃,并出现以下链接错误:

Dyld Error Message:
  Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Applications/MyApp.app/Contents/MacOS/MyApp
  Reason: image not found

That means the app is trying to load the open ssl libraries that might not be present on that mac.这意味着该应用程序正在尝试加载该 Mac 上可能不存在的开放 ssl 库。 There might be just an older version, or that folder might not exist at all?可能只有旧版本,或者该文件夹可能根本不存在? So that's definitely a no-solution.所以这绝对是没有办法的。

Here lies my issue , I have no idea how to solve this problem.这是我的问题,我不知道如何解决这个问题。

Removing -lssl -lcrypto from the linking doesn't help, as the has errors during linking.从链接中删除-lssl -lcrypto没有帮助,因为链接期间有错误。

I guess I need a way to tell Xcode to look there when compiling only .我想我需要一种方法来告诉 Xcode在编译时看那里 Would that be possible?那可能吗?

If you don't wish to ship libraries and deal with making sure the linker can find them, you can link your code against a static library.如果您不想发送库并确保 linker 可以找到它们,您可以将您的代码与 static 库链接。

Using the code in this question as a linking example, I compiled with this command:使用此问题中的代码作为链接示例,我使用以下命令进行编译:

cc -I/opt/homebrew/Cellar/openssl@1.1/1.1.1q/include -o Link14 Link14.cpp /opt/homebrew/Cellar/openssl@1.1/1.1.1q/lib/libcrypto.a -lc++

This uses system libraries for most things, but the static version of libcrypto in libcrypto.a for the encryption.这在大多数情况下使用系统库,但libcrypto.a libcrypto加密。 You can add multiple by placing them on the compile/link line.您可以通过将它们放在编译/链接行上来添加多个。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装 cocoapods 时遇到问题:未加载库:libssl.1.0.0.dylib - Trouble with installing cocoapods: Library not loaded: libssl.1.0.0.dylib 命令 PhaseScriptExecution 失败,退出代码非零,Xcode 10.1 dyld:库未加载:/usr/local/opt/readline/lib/libreadline.7.dylib - Command PhaseScriptExecution failed with a nonzero exit code,Xcode 10.1 dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib Xcode错误-库未加载:/usr/local/opt/icu4c/lib/libicui18n.58.dylib错误134 - Xcode error - Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib error 134 dyld:未加载库:/usr/local/lib/libmpfr.4.dylib - dyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib 在xcode 6中使用动态库有错误:库未加载:/usr/local/lib/xxx.dylib原因:找不到映像 - use dynamic library in xcode 6 have error: Library not loaded: /usr/local/lib/xxx.dylib Reason: image not found dyld:未加载库:/usr/lib/libc++abi.dylib - dyld: Library not loaded: /usr/lib/libc++abi.dylib XCode dylib在/ usr / lib中查找 - XCode dylib looking in /usr/lib Dyld错误消息:库未加载:/usr/lib/libusb-1.0.2.dylib OSX - Dyld Error Message: Library not loaded: /usr/lib/libusb-1.0.2.dylib OSX dyld 崩溃:库未加载:/usr/lib/swift/libswift_Concurrency.dylib 在模拟器上运行 - Crash on dyld: Library not loaded: /usr/lib/swift/libswift_Concurrency.dylib running on simulator Xcode 7.1无法从/ usr / local / lib库链接 - Xcode 7.1 not linking from /usr/local/lib library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM