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
真機
模擬器
2湿刽、合并平臺架構
lipo -create xxx.framework/xxx yyy.framework/yyy -output zzz
將支持真機和模擬器文件進行合并:
合并
3的烁、移除指定平臺架構
lipo xxx.framework/xxx -remove x86_64 -out zzz
移除指定架構
3、提取指定平臺架構
lipo xxx.framework/xxx -thin armv7 -output
提取指定架構
4诈闺、查看 fat file 詳細信息
注意:-detailed_info 此命令只對包含多個指令架構的文件有效渴庆。
lipo -detailed_info xxx.framework/xxx
-detailed_info
注意
上面我們通過 lipo 對 .framework 中的 Mach-O 文件進行操作,如果要使用操作后的 Mach-O 文件雅镊,要確保放回 .framework 中的 Mach-O 文件必須保持原來的文件名襟雷。
文件名保持一致
看懂請隨手點贊,朋友們仁烹!??????