版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shengpeng3344/article/details/54089313
笔者用脚本编译openssl静态库,以便用于iOS工程,但是编译后一直报错
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(async_null.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(async_win.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(cms_cd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_dl.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_openssl.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_vms.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_win32.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ebcdic.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistp224.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistp256.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistp521.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistputil.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(e_rc5.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(m_md2.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(rand_egd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(rand_vms.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(rand_win.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(threads_none.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(threads_win.o) has no symbols
ranlib -c libcrypto.a || echo Never mind.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(async_null.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(async_win.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(cms_cd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_dl.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_openssl.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_vms.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(dso_win32.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ebcdic.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistp224.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistp256.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistp521.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(ecp_nistputil.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(e_rc5.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(m_md2.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(rand_egd.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(rand_vms.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(rand_win.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(threads_none.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcrypto.a(threads_win.o) has no symbols
Undefined symbols for architecture i386:
"_padlock_aes_block", referenced from:
_padlock_cfb_cipher in e_padlock.o
_padlock_ofb_cipher in e_padlock.o
"_padlock_capability", referenced from:
_bind_engine in e_padlock.o
"_padlock_cbc_encrypt", referenced from:
_padlock_cbc_cipher in e_padlock.o
"_padlock_cfb_encrypt", referenced from:
_padlock_cfb_cipher in e_padlock.o
"_padlock_ctr32_encrypt", referenced from:
_padlock_ctr32_encrypt_glue in e_padlock.o
"_padlock_ecb_encrypt", referenced from:
_padlock_ecb_cipher in e_padlock.o
"_padlock_key_bswap", referenced from:
_padlock_aes_init_key in e_padlock.o
"_padlock_ofb_encrypt", referenced from:
_padlock_ofb_cipher in e_padlock.o
"_padlock_reload_key", referenced from:
_padlock_aes_init_key in e_padlock.o
_padlock_cfb_cipher in e_padlock.o
_padlock_ofb_cipher in e_padlock.o
"_padlock_xstore", referenced from:
_padlock_rand_bytes in e_padlock.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_dso.darwin] Error 1
make[1]: *** [engines/padlock.dylib] Error 2
make: *** [all] Error 2
开始以为是少了环境,待mac更新了openssl最新后,编译还是出错,反复尝试,结果采用低版本的openssl却可以
1.1.0c编译不通过,1.0.2j编译却是没问题的
此问题于 2017年1月5日遇到,之后可能能编译1.1.0c吧,若有大神知道出错解决方法,请帮小弟留言。
另附上编译脚本,在xcode8.2 SDK10.2 编译通过
脚本下载:https://pan.baidu.com/s/1kVqILx1 密码 : jju5
有大佬给出的解决方法 :
if [[ "${ARCH}" == "i386" ]]; then ./Configure darwin-i386-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1
脚本中替换下即可