79

I just built a static library for iOS with the build setting for Architectures set to $(ARCHS_STANDARD_INCLUDING_64_BIT).

I want to make sure that the .a library is properly including that architecture, but when i run lipo -info on it, I see:

Architectures in the fat file: library.a are: armv7 armv7s (cputype (16777228) cpusubtype (0))

Does this mean that arm64 isn't included? If the lipo command can't tell me, is there another way to tell?

I'm running Xcode 5 with the latest Command Line Tools installed.

Joel Fischer
  • 6,521
  • 5
  • 35
  • 46

3 Answers3

123

Yes, an arm64 slice is there. To see it, you need to use lipo from the iOS toolchain, not from the host system (which doesn’t know about arm64):

xcrun -sdk iphoneos lipo -info $(FILENAME)
Stephen Canon
  • 103,815
  • 19
  • 183
  • 269
  • 1
    I'm curious about the difference between /usr/bin/lipo and xcrun's lipo. It seems like they are not one and the same. – pshah Oct 13 '13 at 02:48
  • 2
    @pshah It would appear, based on Stephen's answer, that the /usr/bin/lipo is the Mac's version of Lipo, while xcrun's lipo is XCode's lipo. So updating to XCode 5 meant getting a new lipo through xcrun. – Joel Fischer Oct 16 '13 at 15:50
  • 25
    Presumably because the one came out after the other, the `lipo` that ships with v10.9 appears to recognise arm64 natively. No need to invoke anything from Xcode. Running simply `lipo -info $(FILENAME)` reported `arm64` amongst others for a relevant library for me when tested. – Tommy Nov 12 '13 at 00:53
  • On my machine, running macOS High Sierra, the lipos are both one and the same. – saagarjha May 17 '18 at 06:48
  • @saagarjha Yes, the default toolchain `lipo` now knows about all the supported architectures; this was not the case when arm64 was new. – Stephen Canon May 21 '18 at 01:32
69

good old file can do the trick, too:

$ file libTestFlight.a

libTestFlight.a: Mach-O universal binary with 5 architectures
libTestFlight.a (for architecture armv7):   current ar archive random library
libTestFlight.a (for architecture armv7s):  current ar archive random library
libTestFlight.a (for architecture i386):    current ar archive random library
libTestFlight.a (for architecture x86_64):  current ar archive random library
libTestFlight.a (for architecture cputype (16777228) cpusubtype (0)):   current ar archive random library

It seems that nobody at Apple cared to add the arm64 cputype to file, yet.

Interestingly, in the iOS 7 Tech Talk Videos ("Architecting Modern Apps, Part 2", PDF page 35) they show a working file tool's output:

enter image description here

Nikolai Ruhe
  • 81,520
  • 17
  • 180
  • 200
19

For a .framework

lipo -info myFramework.framework/MyFramework

Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
  • How does it show is lib static or dynamic? My output: ```Architectures in the fat file: MyFramework are: arm64 x86_64``` for both types. – Sound Blaster Apr 15 '22 at 10:09