lin*_*ize 56 version libraries executable
在 Windows 中,EXE 和 DLL 具有版本信息,至少包括以下字段:
在 Linux 库/可执行文件中:
小智 50
The version info in not explicitly stored in an ELF file. What you have in there is the name of the library, the soname
, which includes the major version.
The full version is usually stored as a part of the library file name.
If you have library, say libtest.so
, then you usually have:
libtest.so.1.0.1
- The library file itself, containing the full versionlibtest.so.1
- Symlink to libtest.so.1.0.1
, having the same name as soname
libtest.so
- Symlink to libtest.so.1
used for linking.在库文件中libtest.so.1.0.1
,将有一个SONAME
在动态部分中调用的条目,表示该库被调用libtest.so.1
。当您针对此库链接程序时,链接的程序将在动态部分的条目soname
下存储库的NEEDED
。
如果你想验证一下,在哪个 ELF 文件中到底是什么,你可以尝试运行:
readelf -a -W elffile
Run Code Online (Sandbox Code Playgroud)
whereelffile
可以是可执行文件的库。
如果你只是想获得库版本,你可以玩:
readelf -d /path/to/library.so |grep SONAME
Run Code Online (Sandbox Code Playgroud)
AFAIK,可执行文件中没有这样的信息(至少默认情况下没有)。
或者您可以依赖程序本身或您的打包系统,正如 Rahul Patil 所写。
Rah*_*til 19
You can use ldconfig -v | grep libraryname
,
also command has option command -V
or binaryfile --version
example :
test@ubuntukrb12:~# ls --version
ls (GNU coreutils) 8.13
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Run Code Online (Sandbox Code Playgroud)
also you can use yum or aptitude based on distro you are using eg.
in RHEL5/CENTOS5/Fedora
you can use yum info packagename
or if it installed then use rpm --version packagename
[root@ldap1 ~]# yum info bind97
Loaded plugins: downloadonly, fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.sin3.sg.voxel.net
* epel: mirror.imt-systems.com
* extras: mirrors.sin3.sg.voxel.net
* updates: mirrors.sin3.sg.voxel.net
Installed Packages
Name : bind97
Arch : i386
Epoch : 32
Version : 9.7.0
Release : 10.P2.el5_8.4
Size : 6.3 M
Repo : installed
Summary : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
URL : http://www.isc.org/products/BIND/
License : ISC
Description: BIND (Berkeley Internet Name Domain) is an implementation of the DNS
: (Domain Name System) protocols. BIND includes a DNS server (named),
: which resolves host names to IP addresses; a resolver library
: (routines for applications to use when interfacing with DNS); and
: tools for verifying that the DNS server is operating properly.
Run Code Online (Sandbox Code Playgroud)
In Ubuntu
You can use aptitude show pkgname
or dpkg --version pkgname
root@ubuntukrb12:~# aptitude show bind9utils
Package: bind9utils
State: installed
Automatically installed: yes
Version: 1:9.8.1.dfsg.P1-4ubuntu0.4
Priority: optional
Section: net
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Uncompressed Size: 306 k
Depends: libbind9-80, libc6 (>= 2.14), libdns81, libisc83, libisccc80, libisccfg82
Conflicts: bind9utils
Replaces: bind9 (<= 1:9.5.0~b2-1), bind9 (<= 1:9.5.0~b2-1)
Description: Utilities for BIND
This package provides various utilities that are useful for maintaining a working BIND installation.
Run Code Online (Sandbox Code Playgroud)
小智 8
运行它以获取版本信息 - strings libssl.so.1.0.0 | grep "1\.0"
SSLv3 part of OpenSSL 1.0.2p-fips 14 Aug 2018
OpenSSL 1.0.2p-fips 14 Aug 2018
TLSv1 part of OpenSSL 1.0.2p-fips 14 Aug 2018
DTLSv1 part of OpenSSL 1.0.2p-fips 14 Aug 2018
Run Code Online (Sandbox Code Playgroud)
小智 6
对于基于 Redhat 的系统,请执行以下操作:
ldd [file you want to run] | > needed-packages
Run Code Online (Sandbox Code Playgroud)
检查需要的包文件,确保库文件名中没有路径名。如果是这样删除它们,那么“/bin/lib/libx.so.1”更改为“libx.so.1”
找出包含库的包
yum -y provides [lib name]
Run Code Online (Sandbox Code Playgroud)
或者将其放入脚本或从 cmd 行运行:
for lib in `cat libs.txt`;
do
yum -y provides $lib | head -2 | grep " : " >> packages.list
done
Run Code Online (Sandbox Code Playgroud)
接下来,创建以下脚本或从 cmd 行运行:
for package in `cat packages.list | awk '{ print $1 }'`;
do
yum -y install $package
done
Run Code Online (Sandbox Code Playgroud)
你完成了,运行你的程序。如果在运行时出现 GUI 错误。将它们复制下来,如果它们是库引用,请找到它们的包并以相同的方式安装。