本文介绍了iOS的库位code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近下载X code 7测试版,和X code抱怨我的一些C库没有被编入位code。我怎么会去告诉Clang的生产位code这是与iOS兼容?我已经看到了类似计算器的答案,但我不知道他们是否适用于生产位code库于iOS。

I recently downloaded Xcode 7 beta, and Xcode complains about some of my C libraries not being compiled into BitCode. How would I go about telling Clang to produce BitCode that is compatible with iOS? I've seen similar answers on stackoverflow, but I don't know if they apply to producing BitCode libraries for iOS.

编辑:

我使用的是正确的设置,-fembed位code,但是当我尝试存档,我得到的错误:
LD:警告:忽略文件XXXX / XXXX,文件是专为存档而不是被链接(arm64)架构。
当我使用-fembed位code-标志,我可以存档,但我得到的错误:
无法生成完整的位code包,因为XX / XX只与位code标记建立。必须根据X code存档生成库位code构建支持。

I am using the correct setting, -fembed-bitcode, but when I try to archive, I get the error:ld: warning: ignoring file XXXX/XXXX, file was built for archive which is not the architecture being linked (arm64).When I use -fembed-bitcode-marker, I can archive, but I get the error:full bitcode bundle could not be generated because XX/XX was built only with bitcode marker. The library must be generated from Xcode archive build with bitcode enabled.

这是什么错误任何想法?该库编译成功,但它不会让我归档。我创建了一个简单的附加功能,使它成为一个图书馆,我也得到了同样的症状,所以它不是我编译库。

Any ideas on what is going wrong? The library is compiling successfully, but it doesn't let me archive. I created a simple add function and made it into a library, and I get the same symptoms, so it is not the library I'm compiling.

编辑2:
您必须构建两个arm64和使用位code版本的ARMv7和脂类在一起。使用位code归档时,并没有带走的脂肪库的需要。来源:https://forums.developer.apple.com/message/25132#25132

推荐答案

在构建静态库,您必须对位code代以下内容:

When building static libraries you must the following for bitcode generation:

-fembed-bitcode 

注:此命令仅适用于X code7 +

Note: This command is only available with Xcode7+

在关于使用公认的答案 -fembed位code-标记

In regards to the accepted answer of using -fembed-bitcode-marker

您应该知道,一个正常的构建与
  -fembed位code-标记选项将产生最小尺寸的嵌入式位code段没有任何实际内容。这是作为一个方式进行
  测试你构建的位code有关的方面,而不会减慢
  构建过程。当你这样做的实际位code含量是包含
  归档版本。

bwilson苹果员工。
https://forums.developer.apple.com/thread/3971#12225

bwilson Apple Staff.https://forums.developer.apple.com/thread/3971#12225

要更具体地:


  • -fembed位code-标记简单地纪念该位code将在归档后生成二进制文件。

  • -fembed位code 实际执行满位code的产生和嵌入,所以这是你需要使用构建静态库的内容。

  • X code本身建立与 -fembed位code-标记定期生成(如部署到仿真器)

  • X $ C $仅C建立与 -fembed位code 归档建立/产品构建(因为这是只需要为苹果)。

  • -fembed-bitcode-marker simply marks where the bitcode would be in the binary after an archive build.
  • -fembed-bitcode actually does the full bitcode generation and embedding, so this is what you need to use for building static libraries.
  • Xcode itself builds with -fembed-bitcode-marker for regular builds (like deploy to simulator)
  • Xcode only builds with -fembed-bitcode for archive builds / production builds (as this is only needed for Apple).

这篇关于iOS的库位code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 20:56