Xcode构建选项的影响“启用bitcode”是/否 [英] Impact of Xcode build options "Enable bitcode" Yes/No

查看:464
本文介绍了Xcode构建选项的影响“启用bitcode”是/否的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我认识到关于parse.com库的大量警告:


紧急:所有bitcode都将被删除,因为'[路径] /Parse.framework/Parse(PFAnalytics.o)'是在没有bitcode的情况下构建的。您必须在启用bitcode(Xcode设置ENABLE_BITCODE)的情况下重建它,从供应商处获取更新的库,或禁用此目标的bitcode。注意:这将是一个错误。


我知道我可以用这个答案但我现在想知道它是否会对AppStore提交和/或我的应用程序的实际性能产生任何负面影响。



Xcode告知您有关bitcode的信息


激活此设置表示目标或项目应该在编译期间为支持它的平台和体系结构生成bitcode。对于存档构建,将在链接二进制文件中生成bitcode以提交到应用商店。对于其他构建,编译器和链接器将检查代码是否符合bitcode生成的要求,但不会生成实际的bitcode。 [ENABLE_BITCODE]


但是我没有从本文中获得任何真正有用的信息。




  • 我是否可以使用链接的答案来避免问题而不会产生任何负面影响并且不会影响未来的AppStore提交?

  • ENABLE_BITCODE 实际上做了什么,将来会是非选择性要求吗?

  • 如果启用/禁用它会对性能产生什么影响吗?


解决方案



  • ENABLE_BITCODE实际上做了什么,将来会是非选择性要求吗?


我不确定你在什么级别寻找答案,所以让我们一趟。其中一些你可能已经知道了。



在构建项目时,Xcode为Objective-C目标调用 clang 和Swift目标的 swift / swiftc 。这两个编译器都将应用程序编译为中间代表(IR),其中一个IR是bitcode。从这个IR,一个名为LLVM的程序接管并创建x86 32和64位模式(用于模拟器)和arm6 / arm7 / arm7s / arm64(用于设备)所需的二进制文件。通常,所有这些不同的二进制文件都集中在一个文件中,名为胖二进制文件



ENABLE_BITCODE选项删除了最后一步。它使用IR bitcode二进制文件创建应用程序版本。这有很多不错的功能,但有一个巨大的缺点:它无法在任何地方运行。为了获得一个运行bitcode二进制文件的应用程序,bitcode需要重新编译(可能已组装或转码......我不确定正确的动词)到x86或ARM二进制文件中。 / p>

当bitcode应用程序提交到App Store时,Apple将执行最后一步并创建完成的二进制文件。



目前,bitcode应用程序是可选的,但历史记录显示Apple将可选内容转化为需求(如64位支持)。这通常需要几年时间,因此第三方开发人员(如Parse)有时间更新。



  • can我使用上述方法没有任何负面影响并且不会影响未来的appstore提交?


是的,你可以关闭ENABLE_BITCODE,一切都会像以前一样工作。在苹果公司将bitcode应用程序作为App Store的要求之前,你会没事的。



  • 是否有任何表现如果我启用/禁用它会产生影响吗?


启用它不会对性能产生负面影响,但是用于测试的应用程序的内部分发可能会变得更加复杂。



至于正面影响......这很复杂。



对于在App Store中的分发,Apple将为每个机器架构(arm6 / arm7 / arm7s / arm64)创建应用程序的单独版本,而不是一个带有胖二进制文件的应用程序。这意味着安装在iOS设备上的应用程序将更小。



此外,当重新编​​译bitcode时(可能会再次组装或转码...我不确定正确的动词),它被优化。 LLVM始终致力于创建新的更好的优化。理论上,App Store可以在每个新版本的LLVM中在App Store中重新创建应用程序的单独版本,因此您的应用程序可以使用最新的LLVM技术进行重新优化。


Yesterday I recognized a ton of warnings regarding the parse.com library:

URGENT: all bitcode will be dropped because '[path]/Parse.framework/Parse(PFAnalytics.o)' was built without bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. Note: This will be an error in the future.

I am aware of the fact that I can remove those warning with this answer but am now wondering if it will have any negative impact in regards to AppStore submission and / or actual performance of my app.

Xcode informs you regarding bitcode

Activating this setting indicates that the target or project should generate bitcode during compilation for platforms and architectures which support it. For Archive builds, bitcode will be generated in the linked binary for submission to the app store. For other builds, the compiler and linker will check whether the code complies with the requirements for bitcode generation, but will not generate actual bitcode. [ENABLE_BITCODE]

But I am not getting any really useful information out of this text.

  • Can I use the linked answer to circumvent the issue without any negative impact and without compromising a future AppStore submission?
  • What does the ENABLE_BITCODE actually do, will it be a non-optional requirement in the future?
  • Are there any performance impacts if I enable / disable it?

解决方案

  • What does the ENABLE_BITCODE actually do, will it be a non-optional requirement in the future?

I'm not sure at what level you are looking for an answer at, so let's take a little trip. Some of this you may already know.

When you build your project, Xcode invokes clang for Objective-C targets and swift/swiftc for Swift targets. Both of these compilers compile the app to an intermediate representation (IR), one of these IRs is bitcode. From this IR, a program called LLVM takes over and creates the binaries needed for x86 32 and 64 bit modes (for the simulator) and arm6/arm7/arm7s/arm64 (for the device). Normally, all of these different binaries are lumped together in a single file called a fat binary.

The ENABLE_BITCODE option cuts out this final step. It creates a version of the app with an IR bitcode binary. This has a number of nice features, but one giant drawback: it can't run anywhere. In order to get an app with a bitcode binary to run, the bitcode needs to be recompiled (maybe assembled or transcoded… I'm not sure of the correct verb) into an x86 or ARM binary.

When a bitcode app is submitted to the App Store, Apple will do this final step and create the finished binaries.

Right now, bitcode apps are optional, but history has shown Apple turns optional things into requirements (like 64 bit support). This usually takes a few years, so third party developers (like Parse) have time to update.

  • can I use the above method without any negative impact and without compromising a future appstore submission?

Yes, you can turn off ENABLE_BITCODE and everything will work just like before. Until Apple makes bitcode apps a requirement for the App Store, you will be fine.

  • Are there any performance impacts if I enable / disable it?

There will never be negative performance impacts for enabling it, but internal distribution of an app for testing may get more complicated.

As for positive impacts… well that's complicated.

For distribution in the App Store, Apple will create separate versions of your app for each machine architecture (arm6/arm7/arm7s/arm64) instead of one app with a fat binary. This means the app installed on iOS devices will be smaller.

In addition, when bitcode is recompiled (maybe assembled or transcoded… again, I'm not sure of the correct verb), it is optimized. LLVM is always working on creating new a better optimizations. In theory, the App Store could recreate the separate version of the app in the App Store with each new release of LLVM, so your app could be re-optimized with the latest LLVM technology.

这篇关于Xcode构建选项的影响“启用bitcode”是/否的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆