Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a static library is built for 64-bit?

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.

like image 781
Joel Fischer Avatar asked Sep 24 '13 22:09

Joel Fischer


People also ask

How can I tell if a LIB file is 64-bit?

Therefore, the “/usr/lib/libc-2.33.so” file is a 64-bit library and the other one is a 32-bit library. Also, if we have a look at their “start address” fields, they have 64-bit and 32-bit wide addresses respectively.


3 Answers

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)
like image 58
Stephen Canon Avatar answered Sep 21 '22 15:09

Stephen Canon


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

like image 26
Nikolai Ruhe Avatar answered Sep 21 '22 15:09

Nikolai Ruhe


For a .framework

lipo -info myFramework.framework/MyFramework

like image 29
Matthieu Riegler Avatar answered Sep 21 '22 15:09

Matthieu Riegler