Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the version number of libxxx.a

I'm probably not finding the right search words, but I can't find out how to get the version number of a static (or dynamic ) lib without writing a program. Surely there must be a unix application to do this (with equivalent on os x). (I tried the finder info, and it told me that .a files are files to be opened by text wrangler!).

Thanks.

like image 921
John Velman Avatar asked Oct 08 '22 16:10

John Velman


1 Answers

A static lib is just an archive of object files; it doesn't have an implicit version number. Many libraries will have an explicit version number, some symbol like FOO_VERSION_ with contents "1.2.3", but there's obviously no generic way to find any such symbols.

Dynamic libs are a different story. They have two version numbers, "current" and "compatibility". See the manpage for otool, but you can easily parse whichever one you want out of the -l (in the LC_ID_DYLIB command) or -L output (look for the library's own name).

like image 187
abarnert Avatar answered Oct 12 '22 09:10

abarnert