ioslipo

iOS fat binaries and thinning out


I have an app that when using file, reports that it has 2 architectures in the Mach-O

iPad:~/map/MyApp.app root# file MyApp
   MyApp: Mach-O fat file with 2 architectures

EDIT - I have also checked this with Xcode's tool

xcrun -sdk iphoneos lipo -info MyApp
Architectures in the fat file: MyApp are: armv7 arm64

When I use otool to locate the architectures, I can see I have 2, an ARMv7(cpusubtype 9) and a ARM64 (cpysubtype 0)

iPad:~/map/MyApp.app root# otool -arch all -Vh MyApp
MyApp (architecture cputype (12) cpusubtype (9)):
Mach header
  magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC     ARM          9  0x00     EXECUTE    41       4760   NOUNDEFS DYLDLINK TWOLEVEL PIE

MyApp (architecture cputype (16777228) cpusubtype (0)):
Mach header
  magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64 16777228          0  0x00     EXECUTE    41       5368   NOUNDEFS DYLDLINK TWOLEVEL PIE

However when I try to use lipo to thin out the binary, I get the following error

iPad:~/map/MyApp.app root# lipo -thin armv7 MyApp -output ~/map/myappv7
-sh: /usr/bin/lipo: Bad CPU type in executable

Any ideas why I can't think out this particular binary? I did update my lipo binary as the previous one when used with armv7 said: no architecture of this type.


Solution

  • We had several issues we could not explain in the past with lipo, which all of them were no issue using Xcodes lipo.

    Give it a try:

    xcrun -sdk iphoneos lipo -thin armv7 MyApp -output ~/map/myappv7