How can I know which architecture an *.a file is built for?
Asked Answered
L

3

6

I'm working on mac OS 10.7.4. using Xcode 4.3.2 .

I had a *.a static library file from my partner. I want to know which architecture it is built for. Is it ARMv6, ARMv7, i386 or other architecture?

Is there any command or method to get info about the architecture of the file?

Luteous answered 17/8, 2012 at 7:1 Comment(0)
H
10

You can use otool to find out the architecture(s) of a file: otool man page

otool -hv mylibrary.a
Horseleech answered 17/8, 2012 at 7:6 Comment(0)
M
5

The Unix/Linux file command will tell you what kind of file it is:

% file a.out
a.out: Mach-O 64-bit executable x86_64
Marmolada answered 17/8, 2012 at 7:8 Comment(3)
I mean mostly randomly. Also, its output is not canonical - it can even vary from release to release (note I'm not saying it's wrong, I'm just saying that otool is specifically designed for such operations).Horseleech
Example of when file doesnt print the architecture. "file libnanomsg.a" outputs "libnanomsg.a: current ar archive random library"Argumentative
Doesn't print for me on OS X MaverickAgglomeration
B
0

Use the following commnad

lipo -archs yourlibrary.a 
Bissonnette answered 7/10 at 16:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.