archive 打包出错 apple mach-o linker (id) error

1: 情形: 编译真机运行都可以,就打包时报错

 

报错内容
ld: bitcode bundle could not be generated because '/Users/liuyuning/Desktop/TestDecode/Decode/libDecode.a(Decode.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)



 

 

2: Bitcode是苹果在Xcode7及以后推出的新功能。用于代码的二次编译,针对CPU进行优化,编译工作由苹果AppStore后台来完成。
针对iOS是可选项,默认打开。watchOS 和 tvOS 是必选项。苹果文档如下

 

 

这时,就需要给静态库的工程增加一个选项“-fembed-bitcode”。之后就可以正常Archive了。

 

增加“-fembed-bitcode”





另外,如果静态库的工程有 -Werror 的选项,需要去掉。应为在编译的时候有一个警告。 clang: warning: argument unused during compilation: '-fembed-bitcode-marker'
如果不去掉就会报错。


 

 

 

3:如果方法二无效,如果

 

 

那么你选择的第三发SDK也一定也要支持bitcode 为YES

 

posted @ 2017-09-22 17:59  Nelsen_Chen  阅读(637)  评论(0编辑  收藏  举报