macos 在 OS X 上,如何找出共享库是为什么架构编译的?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3377147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
On OS X, how do I find out what architecture a shared lib is compiled for?
提问by Gorann Semara
I need to know whether I compiled libjpeg for 32 or 64 bits architecture, but don't know how to find out, is there a command that will let me check?
我需要知道我是为 32 位架构还是 64 位架构编译了 libjpeg,但不知道如何查找,是否有命令可以让我检查?
回答by Gary
just type file libjpeg.dylib
and you'll get output like the following
只需输入file libjpeg.dylib
,您将获得如下输出
libpoll.dylib: Mach-O universal binary with 3 architectures
libpoll.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
libpoll.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libpoll.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc
回答by ubiyubix
The file
command will work just fine. Alternatively, you can use
otool
to print the fat headers.
该file
命令将正常工作。或者,您可以使用
otool
打印胖标题。
$ otool -vf /usr/lib/libSystem.B.dylib
Fat headers
fat_magic FAT_MAGIC
nfat_arch 2
architecture ppc
cputype CPU_TYPE_POWERPC
cpusubtype CPU_SUBTYPE_POWERPC_ALL
offset 4096
size 2221800
align 2^12 (4096)
architecture ppc64
cputype CPU_TYPE_POWERPC64
cpusubtype CPU_SUBTYPE_POWERPC64_ALL
offset 2228224
size 2169980
align 2^12 (4096)
回答by Mahmoud Al-Qudsi
Use the file
command:
使用file
命令:
[mqudsi@iqudsi:Xcode/FSLogger]$ file ./original (07-31 02:53)
./original: Mach-O executable i386