静态库“.a”的拆分与合并
2021-04-01 本文已影响0人
__Mr_Xie__
查看 .a
文件所包含架构
lipo -info lib.a
按架构分离不同平台的静态库
lipo lib.a -thin i386 -output i386.a
lipo lib.a -thin x86_64 -output x86_64.a
lipo lib.a -thin armv7 -output armv7.a
lipo lib.a -thin armv7s -output armv7s.a
lipo lib.a -thin arm64 -output arm64.a
在当前目录拆分静态库为目标文件.o
ar -x lib.a
将目标文件.o
合并为静态库
libtool -static -o newLib.a *.o
将不同架构平台的静态库合并为完整的通用静态库
lipo -create armv7.a arm64.a -output newLib.a
注意⚠️

如果是
.framework
类型的静态库,命令跟.a
类型的静态库命令基本类似,这里就随便举个例子吧,查看 .framework
文件所包含架构,命令如下:
lipo -info AlipaySDK
Author
如果你有什么建议,可以关注我的公众号:iOS开发者进阶
,直接留言,留言必回。