Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-24-2012, 01:48 AM
|
#1
|
LQ Newbie
Registered: May 2012
Posts: 15
Rep:
|
How to determine if a .a file is 32 bit or 64 bit?
Hi,
I have a file "liberm.a". Is there a command to determine whether this .a file is compatible with 32 bit or 64 bit compiler?
|
|
|
05-24-2012, 01:58 AM
|
#2
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
Try the file command
|
|
|
05-24-2012, 02:16 AM
|
#3
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
Hi CatKin,
file command gives me the following output.
[root@dyl02703app004 lib]# file liberm.a
liberm.a: current ar archive
|
|
|
05-24-2012, 02:25 AM
|
#4
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,799
|
probably it means the liberm.a is compatible with the current system (so if you have a 32bit system this lib is 32bit too).
you can also try ar to unpack archive and execute file on <something>.o
|
|
1 members found this post helpful.
|
05-24-2012, 02:32 AM
|
#5
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
Hi pan64,
but when I run a makefile which uses liberm.a, I get an error that it is incompatible.
Please find the error below: (here, -lerm refers to liberm.a)
/usr/bin/ld: skipping incompatible /home/wholesale/children/dev5/lib/liberm.a when searching for -lerm
/usr/bin/ld: cannot find -lerm
|
|
|
05-24-2012, 02:38 AM
|
#6
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,799
|
so in this case it is incompatible with the files you are actually trying to link - I do not see the command line. So you can try also to write a dummy main and link this lib also you can change arch by: -m32 or -m64.
|
|
|
05-24-2012, 02:41 AM
|
#7
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
The .a files are only archives. You have to query the object files inside them to retrieve this information:
Code:
objdump -f liberm.a | grep "file format"
and you will retrieve either elf64-x86-64 or elf32-i386.
|
|
1 members found this post helpful.
|
05-24-2012, 02:55 AM
|
#8
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
Hi colucix, what exactly do you mean by "file format" ?
|
|
|
05-24-2012, 02:57 AM
|
#9
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,799
|
Quote:
Originally Posted by Tinyspark
Hi colucix, what exactly do you mean by "file format" ?
|
that is what you asked. Is this a 32bit or 64bit code?
On some platform file reports it correctly (and there is no objdump), on some other platform you can try objdump or that dummy main.c to test it.
|
|
|
05-24-2012, 03:13 AM
|
#10
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
Thanks colucix and pan64.
objdump command has given me the required output.
|
|
|
05-24-2012, 03:22 AM
|
#11
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Quote:
Originally Posted by Tinyspark
Hi colucix, what exactly do you mean by "file format" ?
|
It is only a string in the output of objdump, which refers to the architecture of the object files, as pan64 already pointed out. Look at the entire output of objdump (whitout piping to grep) to have a clearer picture of the whole thing.
|
|
|
All times are GMT -5. The time now is 04:03 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|