How do I determine the target architecture of static library (.a) on Mac OS X?

后端 未结 5 533
再見小時候
再見小時候 2020-12-04 05:33

I\'m interested in verifying if a given iPhone static library has been built for ARM or Intel.

It\'s more curiosity than anything. Is there some kind of Mac OS X o

5条回答
  •  时光说笑
    2020-12-04 05:52

    As mentioned earlier, file does not always work. otool -hv -arch all is probably the closest thing that is guaranteed to work - it gives architecture information for every single object file in the library.

    Example:

    % otool -hv /sw/lib/libfftw3.a
    Archive : /sw/lib/libfftw3.a
    /sw/lib/libfftw3.a(align.o):
    Mach header
          magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
    MH_MAGIC_64  X86_64        ALL  0x00      OBJECT     3        336 SUBSECTIONS_VIA_SYMBOLS
    /sw/lib/libfftw3.a(alloc.o):
    Mach header
          magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
    MH_MAGIC_64  X86_64        ALL  0x00      OBJECT     3        416 SUBSECTIONS_VIA_SYMBOLS
    ...
    

提交回复
热议问题