Lipo Making a fat static library for iOS device and simulator

Some third party iOS library providers provide separate static library archives for simulator (i386) and device (armv6 and or armv7).

That's a pain since you either change them manually or set the linking flags on different Xcode targets to use the appropriate library (whereas normally with libraries and frameworks you just drag it into your project and you're done).

Instead, you can build your own fat (multi-architecture) library from the provided archives and Xcode will link against the appropriate architecture segment. 

We achieve this using the lipo tool, eg: 

lipo -output lib_fat.a -create -arch armv6 lib_device.a -arch l386 lib_sim.a

If they provide two archives—one regular i386 archive (with no fat header) for the simulator and one fat archive for the device with armv6 and armv7 segments. Since the device archive headers now specify the archives already, we don't need to tell lipo anything other than the archive file name.:

lipo -create lib_device.a lib_sim.a -output lib_fat.a

 

原文地址:https://www.cnblogs.com/simonshi2012/p/3046186.html