Cam
Cam

Reputation: 285

iOS:Unix:Mac extract info from a static lib regarding supported architecture(s). How?

I have a static library on my Mac and curious to know if the lib was built for armV7s architecture or not? Is any command/tools available to show the supported architectures in this library?

Thank you, Kamran

Upvotes: 1

Views: 1336

Answers (3)

Nate
Nate

Reputation: 31045

Not disagreeing with the other answers, but here's one more option: use the lipo command.

The Apple man pages for lipo

You can run lipo -info on executables, or libraries. Some examples:

minime:arc username$ lipo -info libarclite_iphonesimulator.a
input file libarclite_iphonesimulator.a is not a fat file
Non-fat file: libarclite_iphonesimulator.a is architecture: i386

minime:iPhone username$ cd HelloWorld.app/
minime:HelloWorld.app username$ lipo -info HelloWorld
Non-fat file: HelloWorld is architecture: armv7

Upvotes: 2

Till
Till

Reputation: 27597

You may use otool for getting that information.

From otool's manpage

-L Display the names and version numbers of the shared libraries that the object file uses. As well as the shared library ID if the file is a shared library.

Example

> otool -L libRaptureXML_universal.a 

Archive : libRaptureXML_universal.a (architecture armv7)
libRaptureXML_universal.a(RXMLElement.o) (architecture armv7):
Archive : libRaptureXML_universal.a (architecture i386)
libRaptureXML_universal.a(RXMLElement.o) (architecture i386):

Upvotes: 4

Paulo Scardine
Paulo Scardine

Reputation: 77251

your-mac:~ yourlogin$ file /Path/to/somebinary

/Path/to/somebinary: Mach-O universal binary with 3 architectures
/Path/to/somebinary (for architecture x86_64):    Mach-O 64-bit executable x86_64
/Path/to/somebinary (for architecture i386):      Mach-O executable i386
/Path/to/somebinary (for architecture ppc7400):   Mach-O executable ppc

Upvotes: 4

Related Questions