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 appreview@apple.com.

使用了私有方法,发现是编译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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,490评论 0 10
  • 为什么打出的静态库要支持这么多架构? 看看这个文章:http://blog.csdn.net/zuoyou1314...
    今年27阅读 1,473评论 3 3
  • iOS之PJSIP的编译与简单使用 原创2017年02月22日 16:26:12 标签: ios/ pjsip/ ...
    kpyue阅读 1,998评论 0 0
  • 明媚的除夕。 她伫立在街头的花丛里,笑脸迎向了我,绽放的像一朵太阳花。岁月在她眼角刻下了痕迹,在我眼里更像花瓣柔嫩...
    月亭阅读 707评论 11 9
  • 不记得是在哪看到的文章,说女人一旦过了25岁,身体就会开始走向衰老,新老细胞的更替会进入一个相反的趋势。肌...
    忆凝阅读 712评论 0 1