I have a static library supplied to me that I need to use in an app. I am told it supports ARM64.
When I list the mach headers using otool -hV mylibrary.a
, then I only get x86_64
for CPU type.
When I list the fat headers using otool -fv mylibrary-a
, then I get CPU types I386, x86_64, ARM, ARMv7S. ARM64.
It was my understanding that I needed mach headers for the architectures that I am going to run on. However, the app works fine on 64 bit device.
What is the difference between fat headers and mach headers in iOS development ? Is this library safe to use for a 64-bit app ?
mach header and universal header provide similar information. They identify things like cputype and cpusubtype, amongst other things. The universal header also indicates the file offset/size for each architecture. I believe that universal header is obtaining information from the mach header, but I could easily be wrong about that.
If you are only seeing x86_64, try otool -hv -arch all myLibrary.a
FWIW, an easier way is to do lipo -info myLibrary.a
. If you see the slice you need you should be good to go, provided the library itself is working properly for that slice.