iOS - 动态库支持多种架构指令集
2020-03-04 本文已影响0人
MichaelLedger
armv7.armv7s,arm64都是ARM处理器的指令集
i386,x86_64是mac的指令集
TARGESTS -> Build Settins:
Architectures -> $(ARCHS_STANDARD)、armv7、armv7s
Build Active Architecture Only -> No
Valid Architectures -> armv7、armv7s、arm64
编译运行前设置Device为:Generic iOS Device
查看支持的指令集:
$ lipo -info MTXSDK.framework/MTXSDK
Architectures in the fat file: MTXSDK.framework/MTXSDK are: armv7 armv7s arm64
模拟器运行需要支持i386,x86_64,可新建Target,去除引用不支持模拟器编译运行的文件
编译运行前设置Device为:任意Simulator
查看支持的指令集:
$ lipo -info MTXSDK.framework/MTXSDK
Architectures in the fat file: MTXSDK.framework/MTXSDK are: i386 x86_64
合并不同指令集的动态库:
lipo -create 真机库.a的路径 模拟器库.a的的路径 -output 合成库的名字.a
$ cd /Users/mxr/Desktop
$ lipo -create /Users/mxr/Library/Developer/Xcode/DerivedData/MTXSDK-cwnzrvkgqpoirnbaqtiwlwzkiwvb/Build/Products/Release-iphoneos/MTXSDK.framework/MTXSDK /Users/mxr/Library/Developer/Xcode/DerivedData/MTXSDK-cwnzrvkgqpoirnbaqtiwlwzkiwvb/Build/Products/Release-iphonesimulator/MTXSDK.framework/MTXSDK -output fat.a
查看支持的指令集:
$ lipo -info fat.a
Architectures in the fat file: fat.a are: i386 x86_64 armv7 armv7s arm64