For example, how to get the version of /usr/lib/libz.a? It will be great if you can get other useful information, such as compiler / arch, etc.
The reason I want to know this is because gcc always says that it ignores the libz that I suggested on the command line when I compile my program and associated with a specific version of libz. gcc thinks /usr/lib/libz.a is correct.
C libraries do not have their own version control system. At best, the library has a symbol.
Answer on Linux / Unix Elf:
.a ar ( tar zip, ), , , . . - , .o. ar:
.a
ar
tar
zip
.o
ar -t /usr/lib/libz.a
objdump:
objdump
objdump -a /usr/lib/libz.a
(.so), - . readelf dumpelf elfutils, , , libc, .. . man readelf .
.so
readelf
dumpelf
libc
man readelf
Mac OS X otool, , ( lipo -info, , arch). :
lipo -info
$otool -L /usr/lib/libz.dylib /usr/lib/libz.dylib: /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
otool -L , ( " " ), - "" , . , Mac.
otool -L
#, -a _ | grep ' '. , , , rpm ( , , , ).
On Linux systems (for example), the version is usually found in the name.This seems to be hidden since the libraries you link to are symbolically linked to a specific version:
> ls -l /usr/lib/libncurses.dylib lrwxr-xr-x 1 root wheel 20 Feb 28 16:08 libncurses.dylib -> libncurses.5.4.dylib
Therefore, when you reference -lncurses, the compiler actually refers to the libncurses.5.4 link in the application. If you look at the symbol table in the application, you will see that it actually stores very specific version information for each lib, and not the general version with which it was associated.
Source: https://habr.com/ru/post/1739077/More articles:Ruby on Rails: Model.all.each vs find_by_sql ("SELECT * FROM model"). - ruby | fooobar.comSetting up the library for inclusion in C ++ - test - c ++visual studio Regex Find / Replace Error - regexHow to check which point is causing the MQ problem? - ibm-mqHow to solve the problem when using jquery datepicker and checking at the same time - jquery-validateWhy does this NOT give a violation of segmentation? - cNo matter what I do, django-admin.py is not found, although it is in my way - pythonclang compiler does not support -pg - clangPHP portal is similar to java portal - phpCasting in MVVM Light CommandParameterValue - silverlightAll Articles