¿Existe un comando en Linux para averiguar si una biblioteca se ha construido en modo de 32 o 64 bits?

gcc 4.5.1
Fedora 14 Linux

I have this static library that was build from a previous programmer. However, he has left the company and we don't have the source code. All we have is the header files *.h y el libnet.a biblioteca estática.

When I am try and link this with our application. I get a incompatible linker error. I think the problem is that the static library has been built on a 32 bit machine. And I am trying to link using a 64 bit machine. I could compile my application using the cflag -m32. However, I just want to know if there is any command that will give me if the static library was built in either 32 or 64 bit mode?

Muchas gracias por las sugerencias,

preguntado el 08 de enero de 11 a las 17:01

has probado el file command? it worked in a binary for me before, so it may work on libraries too. -

3 Respuestas

An .a archive is just a collection of objects, so why not:

ar x libnet.a
file someobj.o

That will give you an answer like:

someobj.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

Respondido el 08 de enero de 11 a las 20:01

Solo corriendo file over it could be enough?

Respondido el 08 de enero de 11 a las 20:01

opening it up in a hex editor with ascii view may reveal some clues

Respondido el 09 de enero de 11 a las 19:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.