lipo的基本用法

简单介绍

lipo 是管理Fat File 的工具,可以查看cpu 架构,提取特定架构,整合和拆分库文件

命令用法

  • 查看静态库指出cpu的架构
1
2
3
4
5
lipo -info 静态库路径.framework/xxxx 或 静态库路径.a

举例:
lipo -info /Users/tgkj/Desktop/TeeagerGreenModel.framework/TeeagerGreenModel
Architectures in the fat file: /Users/tgkj/Desktop/TeeagerGreenModel.framework/TeeagerGreenModel are: armv7 i386 x86_64 arm64
  • 合并静态库
1
2
3
4
lipo -create 静态库路径1  静态库路径2 -output 存放路径

举例:
lipo -create /Users/tgkj/Library/Developer/Xcode/DerivedData/ TeeagerGreenModel-bjryvkwvkylloqeqscwurstbubsa/Build/Products/Release-iphoneos/TeeagerGreenModel.framework/TeeagerGreenModel /Users/tgkj/Library/Developer/Xcode/DerivedData/TeeagerGreenModel-bjryvkwvkylloqeqscwurstbubsa/Build/Products/Release-iphonesimulator/TeeagerGreenModel.framework/TeeagerGreenModel -output /Users/tgkj/Library/Developer/Xcode/DerivedData/TeeagerGreenModel-bjryvkwvkylloqeqscwurstbubsa/Build/Products/Release-iphoneos/TeeagerGreenModel.framework/TeeagerGreenModel
  • 移除指定架构
1
2
3
4
lipo  静态库路径 -remove CPU架构名称 -output 移除后存放路径

举例:
lipo /Users/tgkj/Library/Developer/Xcode/DerivedData/ TeeagerGreenModel-bjryvkwvkylloqeqscwurstbubsa/Build/Products/Release-iphoneos/TeeagerGreenModel.framework/TeeagerGreenModel -remove armv7 -output /Users/tgkj/Library/Developer/Xcode/DerivedData/ TeeagerGreenModel-bjryvkwvkylloqeqscwurstbubsa/Build/Products/Release-iphoneos/TeeagerGreenModel.framework/TeeagerGreenModel

静态库拆分

1
lipo 静态库源文件路径 -thin CPU架构名称 -output 拆分后文件存放路径