确定二进制文件是否包含位码的方法似乎不再起作用 [英] Method to determine whether a binary contains Bitcode no longer seems to work

查看:121
本文介绍了确定二进制文件是否包含位码的方法似乎不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在寻找确定是否使用Bitcode构建iOS二进制文件的方法时,我发现了以下信息:

In my search for a method to determine if a iOS binary was build with Bitcode, I found the following post:

如何检查Xcode7是否支持BITCODE框架

此处,建议使用以下方法确定二进制文件中是否存在位码:

Here, the following method was suggested to determine if bitcode is present in a binary:

$ otool -l libName.o | grep __LLVM

但是,我已经在多个二进制文件上尝试了此方法,但没有成功。其中之一是我知道有位代码的库,因为在更改项目标志后,构建错误消失了。其中另一个是使用Archive生成的文件扩展名的二进制文件。还有一个用于苹果手表。

However, I have tried this on several binaries with no success. One of them is a library I know has bitcode since after I changed the flag on its project a build error went away. Another one of them is a binary for a file extension, build using Archive. And another is for apple watch.

我相信以上所有二进制文件都应具有Bitcode,但我始终无法从上述命令获得任何结果。

I believe all of the above binaries should have Bitcode, and yet I always get no results from the above command.

有人知道适用于最新二进制文件的任何其他方法吗?

Does anyone know any other method that works with the latest binaries?

我正在使用XCode 7.2和10.10.5

I'm using XCode 7.2 and 10.10.5 in case it matters.

更新:这是一个文件的示例,该文件应该具有位码,但上述命令未返回任何内容。它是来自测试文件提供程序的二进制文件。我是通过存档和临时部署生成的,并确保已为目标启用了位码设置。

UPDATE: Here is an example of a file which is supposed to have bitcode but the above command doesn't return anything. It is a binary from a test File Provider. I generated it via Archive and Deploy as Ad Hoc, and made sure the setting for bitcode was on for the target.

https://www.dropbox.com/s/eyuzs5j1t7nsq6t/CustomDocumentProviderFileProvider?dl=0

推荐答案

如果您使用的是胖二进制文件,则需要在特定的计算机上运行 otool -l <​​/ code>切片。例如,在下面的示例中,我选择了arm64:

If you have a fat binary, then you need to run otool -l on a specific slice. For instance, in the following example I chose arm64:

otool -arch arm64 -l MyFramework.framework/MyFramework | grep -a4 __LLVM

在输出中,您应该检查:

In the output you should check:


  1. 如果存在至少一个名为 __ LLVM
  2. 的节,则
  3. 如果大小较大大于零

这篇关于确定二进制文件是否包含位码的方法似乎不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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