iOS 编译Gmssl(no-async)

应用上架被拒:

The app references non-public symbols : _getcontext, _makecontext, _setcontext. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed. If you think this message was sent in error and that you have only used Apple-published APIs in accordance with the guidelines, send the app's Apple ID, along with detailed information about why you believe the above APIs were incorrectly flagged, to [email protected].

使用了私有方法,发现是编译GMSSL时,内部调用了这些方法,编译时设置no-async就可以解决上述问题了。
首先下载GmSSL,准备编译armv7 armv7s i386 x86_64 arm64 等架构的静态库。每个架构对应一个文件夹,将GmSSL代码拷贝5份。

真机(arm64,armv7,armv7s):

  1. 执行命令
./Configure iphoneos-cross no-shared -DOPENSSL_NO_ASYNC
  1. 修改Makefile
CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
CROSS_SDK=iPhoneOS.sdk
CC= /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7(arm64/armv7s)
  1. 执行make命令

模拟器(i386,x86_64):

  1. 执行命令
./Configure iphoneos-cross no-shared -no-asm -DOPENSSL_NO_ASYNC
  1. 修改Makefile
CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
CROSS_SDK=iPhoneSimulator.sdk
CC= /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386(x86_64)
  1. 执行make命令

合并静态库

lipo -create arm64/GmSSL-master/libssl.a armv7/GmSSL-master/libssl.a armv7s/GmSSL-master/libssl.a x86_64/GmSSL-master/libssl.a i386/GmSSL-master/libssl.a -output libssl.a

lipo -create arm64/GmSSL-master/libcrypto.a armv7/GmSSL-master/libcrypto.a armv7s/GmSSL-master/libcrypto.a x86_64/GmSSL-master/libcrypto.a i386/GmSSL-master/libcrypto.a -output libcrypto.a

你可能感兴趣的:(iOS 编译Gmssl(no-async))