Linux check lib version

Viewing Linux Library / Executable version info

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 version
  • libtest.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.

In the library file libtest.so.1.0.1 , there will be an entry called SONAME in dynamic section, that will say this library is called libtest.so.1 . When you link a program against this library, the linked program will store the soname of the library under NEEDED entry in the dynamic section.

If you want to verify, what exactly is in which ELF file, you can try to run:

where elffile can be either an library of an executable.

If you simply want to get the library version, you can play with:

readelf -d /path/to/library.so |grep SONAME 

AFAIK, there’s no such info (at least not by default) in executable files.

Or you can rely on the program itself or your packaging system, as Rahul Patil wrote.

nice info, it’s new to me never used readelf, if you don’t mind , may i ask you where & why use readelf

Readelf (and similar tools) is useful, when you want to look inside an elf file :). I use it mostly when programming to look up symbols in libraries (when something doesn’t work), or when there’s some problem with a library. (man readelf)

You can use ldconfig -v | grep libraryname , also command has option command -V or binaryfile —version

test@ubuntukrb12:~# ls --version ls (GNU coreutils) 8.13 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 

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. 

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 Architecture: amd64 Uncompressed Size: 306 k Depends: libbind9-80, libc6 (>= 2.14), libdns81, libisc83, libisccc80, libisccfg82 Conflicts: bind9utils Replaces: bind9 ( 

Источник

How to know library version?

where 2.6-3 looks completely uncomparable with 68 . How to know if it is greater or not? Here is an example of such a requirement, fmpeg building manual, section libx265 .

3 Answers 3

You should see something like:

libx265-dev Depends: libx265-179 (= 3.2.1-1build1) Suggests: libx265-doc 

The number after Depends: libx265- is the version number which should be ≥ 68.

The libx265-dev package is in the default repositories of Ubuntu 16.04 and later (at least until Ubuntu 22.10). In Ubuntu 18.04 open the terminal and type:

apt-cache show libx265-dev | grep Depends 

libx265-dev version in Ubuntu 18.04 is 146 which is ≥ 68.

I assume you require H.265/HEVC video stream encoder (development files)
and the libx265-dev_2.6-3_amd64 is the latest stable version.
To make sure you are up to date, open a terminal and type
sudo apt-get update && sudo apt-get install libx265-dev

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.13.43531

Ubuntu and the circle of friends logo are trade marks of Canonical Limited and are used under licence.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

What's the best way to check the version of a library on Ubuntu

I am sure there are several ways to do this, but is there a tool built into Ubuntu or a recommended way to check the version of any given library you have installed on an ubuntu server?

1 Answer 1

First off. Sometimes when people talk about libraries they are talking about .deb packages that provide libraries to other packages. We'll deal with that case first. The other context you hear the term library used in is the traditional .so shared object sense. We'll deal with that second.

apt-cache depends will return a list of packages that are dependencies for . Packages are not necessarily congruous with libraries (i.e., libraries in the sense of linkable .so files), but in Debian and Ubuntu libraries are generally packaged as lib . If you do a dpkg -l |grep you can find which package containing which libraries is installed.

kelliott@mis-ke-lnx:~$ apt-cache depends perl perl Depends: perl-base Depends: perl-modules Depends: libbz2-1.0 Depends: libc6 Depends: libdb4.7 Depends: libgdbm3 Depends: zlib1g kelliott@mis-ke-lnx:~$ dpkg -l |grep libc6 ii libc6 2.11.2-10 Embedded GNU C Library: Shared libraries ii libc6-dev 2.11.2-10 Embedded GNU C Library: Development Libraries and Header Files 

Or you can go the other way. If you're wondering what package required the package libwww-perl you can use this handy little perl script to return a list of libwww-perl reverse dependencies that are also installed.

#!/usr/bin/env perl use strict; use warnings; use AptPkg::Cache; my $cache = AptPkg::Cache->new; my $pkg = $ARGV[0] or die 'supply a package name as the first arg'; my @acrd = split /\s+/, `apt-cache rdepends $pkg`; my $state; for (@acrd) < unless ( $_ eq 'Reverse' or $_ eq 'Depends:' ) < $state = $cache->->; print "$_\n" if $state eq 'Installed'; > > 

Now the .so shared object files are a little different. I like to use a combination of ldd and apt-file . Let's say I'm interested in the object files linked against ls :

kelliott@mis-ke-lnx:~$ ldd /bin/ls linux-vdso.so.1 => (0x00007fff8b05d000) libselinux.so.1 => /lib/libselinux.so.1 (0x00007fcfb7e24000) librt.so.1 => /lib/librt.so.1 (0x00007fcfb7c1c000) libacl.so.1 => /lib/libacl.so.1 (0x00007fcfb7a14000) libc.so.6 => /lib/libc.so.6 (0x00007fcfb76b3000) libdl.so.2 => /lib/libdl.so.2 (0x00007fcfb74af000) /lib64/ld-linux-x86-64.so.2 (0x00007fcfb8057000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007fcfb7292000) libattr.so.1 => /lib/libattr.so.1 (0x00007fcfb708e000) kelliott@mis-ke-lnx:~$ apt-file search libattr.so.1 ia32-libs: /lib32/libattr.so.1 ia32-libs: /lib32/libattr.so.1.1.0 libattr1: /lib/libattr.so.1 libattr1: /lib/libattr.so.1.1.0 kelliott@mis-ke-lnx:~$ dpkg -l |grep libattr1 ii libattr1 1:2.4.44-2 Extended attribute shared library kelliott@mis-ke-lnx:~$ file /lib/libattr.so.1 /lib/libattr.so.1: symbolic link to `libattr.so.1.1.0' kelliott@mis-ke-lnx:~$ file /lib/libattr.so.1.1.0 /lib/libattr.so.1.1.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped 

As you can see our good friend ls has quite a few libraries linked against it. libattr.so.1 handles file attributes if I remember correctly. Doing an apt-file search against it shows that it was installed by two packages ia32-libs and libattr1 (one for 32bit and one for 64bit). And on my system it looks like the libattr1 package (at version 1:2.4.44-2) installed the libattr.so shared object file, which upon further investigation is at version 1.1.0.

Источник

Find out library version

I want to find out what version of a C library is installed in my system (Ubuntu 12.04). In particular, I'm interested in libnuma. What is the proper way to do it?

cd /usr/lib ls -l libnuma* -rw-r--r-- 1 root root 70312 Feb 8 2012 libnuma.a lrwxrwxrwx 1 root root 12 Feb 8 2012 libnuma.so -> libnuma.so.1 -rw-r--r-- 1 root root 43976 Feb 8 2012 libnuma.so.1 

4 Answers 4

I would use dpkg -l | grep libnuma1 to get the version.

As an example, I have ran dpkg -l on xterm and you can see that I'm running versoin 278-4 of xterm.

# dpkg -l | grep xterm ii lxterminal 0.1.11-4 amd64 LXDE terminal emulator ii xterm 278-4 amd64 X terminal emulator 

This works most of the time but not applicable when you compile and install the library, because dpkg does not care about libs/apps not installed by dpkg

While @SuB is correct, the fact is that without a packaging system, there's no way to know what release an individual library was built from, as that information is managed by the packaging system and not contained in the library. The library itself only knows its API version (the number after the .so ). When you compile and install a library yourself, it's up to you to keep track of where it came from (which is why packaging systems were created).

It gives me the output but at the beginning of the output there are these two lines. ldconfig: Can't stat /libx32: No such file or directory . ldconfig: Can't stat /usr/libx32: No such file or directory . Is that something to worry about?

ldconfig -v | grep libnuma shows libnuma.so.1 -> libnuma.so.1.0.0 , but dpkg -l | grep libnuma1 shows ii libnuma1:amd64 2.0.12-1 . This variant does not look reliable.

The file name or contents won't always keep track of the exact version, so you'd typically want to use the packaging system facilities. For Ubuntu, you can either go to packages.ubuntu.com, search for your file, and see what version of the package is in your version of Ubuntu.

Or from the command line, you can first search for the name of the associated package using dpkg -S /usr/lib/libnuma.so.1 , which probably returns libnuma1 as the package name. Then run apt-cache showpkg libnuma1 to find the package version. The apt-cache output can be pretty long, but the version should be in the first few lines.

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.13.43531

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Читайте также:  Управление windows через linux
Оцените статью
Adblock
detector