lipo 工具用于查看、提取、合并、拆分二进制文件(Mach-O)的CPU指令架构。
从下面可看出,是Xcode自带工具。
% lipo
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: one of -create, -thin <arch_type>, -extract <arch_type>, -remove <arch_type>, -replace <arch_type> <file_name>, -verify_arch <arch_type> ... , -archs, -info, or -detailed_info must be specified
usage: lipo <input_file> <command> [<options> ...]
command is one of:
-archs
-create
-detailed_info
-extract <arch_type> [-extract <arch_type> ...]
-extract_family <arch_type> [-extract_family <arch_type> ...]
-info
-remove <arch_type> [-remove <arch_type> ...]
-replace <arch_type> <file_name> [-replace <arch_type> <file_name> ...]
-thin <arch_type>
-verify_arch <arch_type> ...
options are one or more of:
-arch <arch_type> <input_file>
-hideARM64
-output <output_file>
-segalign <arch_type> <alignment>
使用方式,例如
// 对于 .framework
lipo -info xxx.framework/xxx
// 对于 .a
lipo -info xxx.a
1、查看支持的平台架构:
lipo -info xxx.framework/xxx
![](https://img.haomeiwen.com/i1237662/a703238c3f0be423.png)
![](https://img.haomeiwen.com/i1237662/5266c4d336b80201.png)
2、合并平台架构
lipo -create xxx.framework/xxx yyy.framework/yyy -output zzz
将支持真机和模拟器文件进行合并:
![](https://img.haomeiwen.com/i1237662/2c8f60f9dba7b3f1.png)
3、移除指定平台架构
lipo xxx.framework/xxx -remove x86_64 -out zzz
![](https://img.haomeiwen.com/i1237662/ee173c02a28e1968.png)
3、提取指定平台架构
lipo xxx.framework/xxx -thin armv7 -output
![](https://img.haomeiwen.com/i1237662/c4f49758540bf560.png)
4、查看 fat file 详细信息
注意:-detailed_info 此命令只对包含多个指令架构的文件有效。
lipo -detailed_info xxx.framework/xxx
![](https://img.haomeiwen.com/i1237662/12ac8447f068861d.png)
注意
上面我们通过 lipo 对 .framework 中的 Mach-O 文件进行操作,如果要使用操作后的 Mach-O 文件,要确保放回 .framework 中的 Mach-O 文件必须保持原来的文件名。
![](https://img.haomeiwen.com/i1237662/01fd0b436f133a86.png)
看懂请随手点赞,朋友们!🌹🌹🌹
网友评论