将OpenSSL库加载到MacOS应用程序

将OpenSSL库加载到MacOS应用程序,openssl,dylib,Openssl,Dylib,我很难将OpenSSL整合到我的MacOS应用程序中,以验证苹果的收据。 以下是我得到的: dyld:未加载库:/usr/local/ssl/lib/libcrypto.1.0.0.dylib 以下是我正在做的: 我正在使用此脚本编译我的OpenSSL库: #!/bin/bash OPENSSL_VERSION="1.0.1e" curl -O -L http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz tar -xvzf

我很难将OpenSSL整合到我的MacOS应用程序中,以验证苹果的收据。 以下是我得到的:

dyld:未加载库:/usr/local/ssl/lib/libcrypto.1.0.0.dylib

以下是我正在做的:

我正在使用此脚本编译我的OpenSSL库:

#!/bin/bash

OPENSSL_VERSION="1.0.1e"

curl -O -L http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386
./Configure darwin-i386-cc -shared
make
cd ../
cd openssl_x86_64
./Configure darwin64-x86_64-cc -shared
make
cd ../
lipo -create openssl_i386/libcrypto.dylib openssl_x86_64/libcrypto.dylib -output libcrypto.dylib
lipo -create openssl_i386/libssl.dylib openssl_x86_64/libssl.dylib -output libssl.dylib
rm openssl-$OPENSSL_VERSION.tar.gz
这给了我
libssl.dylib
libcrypto.dylib

然后我用我的pod文件运行
pod安装

target 'MyApp' do
use_frameworks!
pod 'OpenSSL', '~> 1.0'
end
然后,我尝试运行我的项目,以获得:

dyld: Library not loaded: /usr/local/ssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /Users/me/Source/myApp/DerivedData/myApp/Build/Products/Debug/myApp.app/Contents/MacOS/myApp
  Reason: image not found

我知道我还没有添加librypto库,但是为什么它要在我的
/usr/local/ssl/lib/
中找到它呢?我应该把它放在哪里?

谢谢你的评论,最后我用一个不同的pod
OpenSSL Universal

解决了这个问题,你可能应该添加一些
DYLD\u PRINT.*
来调试库加载问题;看。如果只是“原因:找不到图像”,则使用
install\u name\u tool
更改位置。创建fat库的过程似乎有点失败。您需要确保为i386和x86\u 64保留
opensslconf.h
;看,这里有一些DUP:,等等。