如何判断一个静态库(.a文件)所支持的架构(平台)
2011-10-14 10:37
525 查看
问:
I'm interested in verifying if a given iPhone static library has been built for ARM or Intel.
Its more curiosity than anything. Is there some kind of Mac OS X or BSD specific tool to do this? Thispost gives
an example in Linux.
方法1:
probably tell you.
should be able to. But I'd try
e.g.
Example with archive:
方法2:
Another option is
it's output is brief and more readable that
Example:
方法3:
As mentioned earlier,
not always work.
Example:
How
do I determine the target architecture of static library (.a) on Mac OS X?
I'm interested in verifying if a given iPhone static library has been built for ARM or Intel.Its more curiosity than anything. Is there some kind of Mac OS X or BSD specific tool to do this? Thispost gives
an example in Linux.
方法1:
filewill
probably tell you.
otoolcertainly
should be able to. But I'd try
filefirst,
e.g.
logan:/Users/logan% file d2 d2: Mach-O executable ppc
Example with archive:
logan:/Users/logan% file /usr/lib/libMallocDebug.a /usr/lib/libMallocDebug.a: Mach-O universal binary with 2 architectures /usr/lib/libMallocDebug.a (for architecture i386): current ar archive random library /usr/lib/libMallocDebug.a (for architecture ppc): current ar archive
方法2:
Another option is
lipo,
it's output is brief and more readable that
otool's.
Example:
% lipo -info /usr/lib/libiodbc.a Architectures in the fat file: /usr/lib/libiodbc.a are: x86_64 i386 ppc % lipo -info libnonfatarchive.a input file libnonfatarchive.a is not a fat file Non-fat file: libnonfatarchive.a is architecture: i386 %
方法3:
As mentioned earlier,
filedoes
not always work.
otool -hvis 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
相关文章推荐
- 如何判断一个静态库(.a文件)所支持的架构(平台)
- 在delphi中如何判断一个文件正在被其它的程序或进程所调用?
- 如何检测或判断一个文件或字节流(无BOM)是什么编码类型
- java中如何使用asm动态的生成或修改一个class文件以及asm的架构思想
- windows10UWP:如何判断一个文件或者文件夹是否存在?
- ubuntu如何判断一个文件是32还是64位的
- 如何判断一个(压缩)文件的类型,以及zcat/gzcat
- 如何判断一个文件或目录是否存在
- iOS如何查看静态库.a文件是否支持i386?
- 如何判断Unix系统的一个库文件是32位还是64位的
- 如何在shell中判断一个文件是否为空
- 如何用Spring Cloud搭建一个企业分布式微服务云架构平台
- 【转载】如何在shell中判断一个文件是否为空
- 如何查看文件支持的CPU架构
- 如何判断一个文件是否结束?
- 如何判断一个类是否支持某属性和方法以及如何判断IOS的版本
- 如何判断一个文件是否存在
- 如何判断静态库是否支持64位。
- 如何判断Unix系统的一个库文件是32位还是64位的
- 如何判断一个类是否支持某属性和方法以及如何判断IOS的版本