问题
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?
回答1:
just type file libjpeg.dylib
and you'll get output like the following
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
回答2:
The file
command will work just fine. Alternatively, you can use
otool
to print the fat headers.
$ 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)
回答3:
Use the file
command:
[mqudsi@iqudsi:Xcode/FSLogger]$ file ./original (07-31 02:53)
./original: Mach-O executable i386
来源:https://stackoverflow.com/questions/3377147/on-os-x-how-do-i-find-out-what-architecture-a-shared-lib-is-compiled-for