On a unix / linux system, can I learn more about the mylib.a archive?

In this particular case, I am trying to find out if mylib.a is 32 or 64 bit compatible. I am familiar with ldd for shared objects (mylib.so), but how do I check a regular .a archive?

+3
linux unix archive
08 Oct '08 at 19:40
source share
4 answers

"nm" and "ar" will provide you some information about the library archive.

+9
Oct 08 '08 at 19:43
source share
  $ 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

 ... 

It takes tiered binutils , but it's pretty simple, isn't it?

+7
08 Oct '08 at 20:04
source share

The standard utilities "nm" and "ar" will provide you with archive information.

To find out about the 32/64 bit archive capability, use β€œar” to extract the .o files inside mylib.a, then run the β€œfile” in the .o files to open their type, including 32/64 bit.

+4
08 Oct '08 at 19:52
source share

In general, I just use the "file" utility.

0
Oct 08 '08 at 19:49
source share



All Articles