In this particular case I'm trying to discover if a mylib.a file is 32 or 64 bit compatible. I'm familiar with ldd for shared objects (mylib.so) but how do I inspect a regular .a archive?
+7
A:
"nm" and "ar" will give you some information about the library archive.
JayG
2008-10-08 19:43:49
+3
A:
Standard "nm" and "ar" utilities will give you information about the archive.
To learn about the 32/64 bit ability of the archive use "ar" to extract the .o files inside the mylib.a, then run "file" on the .o files to discover their type including the 32/64 bit usage.
Brett Hall
2008-10-08 19:52:29
+5
A:
$ objdump -G /usr/lib/libz.a In archive /usr/lib/libz.a: adler32.o: file format elf32-i386 ... $ objdump -G /usr/lib64/libz.a In archive /usr/lib64/libz.a: adler32.o: file format elf64-x86-64 ... $ objdump -G /ppc-image/usr/lib/libz.a In archive /ppc-image/usr/lib/libz.a: adler32.o: file format elf32-powerpc ...
Requires a multilib-capable binutils
, but it's pretty straightforward, is it not?
ephemient
2008-10-08 20:04:15
Objdump -G <file> gives a little more concise listing of the formats.
Steve Baker
2008-10-09 13:19:43
Only one line outputted less than `objdump -a`... still, an improvement. Thanks!
ephemient
2008-10-09 14:48:15