How to find out the version number of an installed library

rhelshared libraryyum

Question relevant to RedHat/CentOS.
I'm a little confused between package and library and how to pin them to a fixed version.

There's an X11 rollover bug in recent libxcb versions that affects my C programs. libxcb-1.5-1 doesn't have that bug.

So I did:

# yum remove libxcb-devel
# rpm -Uvh --oldpackage libxcb-1.5-1.el6.i686.rpm 

And now the bug is gone and my software works fine.

Fast forward a few weeks and the bug is back.

# yum info libxcb-devel
Loaded plugins: refresh-packagekit, security
Available Packages
Name       : libxcb-devel
Arch       : i686
Version    : 1.9.1
Release    : 2.el6
Size       : 1.0 M
Repo       : sl-security

But is that the installed version or the version available through the repo ?
How can I tell which version of libxcb is currently installed ?

$ ll /usr/lib/libxcb.so*
lrwxrwxrwx 1 root root     15 Aug  6 03:38 /usr/lib/libxcb.so.1 -> libxcb.so.1.1.0*
-rwxr-xr-x 1 root root 130752 Oct 14  2014 /usr/lib/libxcb.so.1.1.0*
$ readelf -d /usr/lib/libxcb.so.1.1.0 | grep SONAME
 0x0000000e (SONAME)                     Library soname: [libxcb.so.1]

So I'm confused between the version number shown by yum, the number on the .so and the number I want…

Best Answer

If you want to know what version is installed, just run:

rpm -q libxcb-devel

If you want to prevent upgrades to this package, you can add the package to the yum exclude configuration. Add the following to the main section in /etc/yum.conf:

exclude=libxcb-devel

The library version (e.g., in libxcb.so.1.1.0) very seldom tracks the package version, and is meant to track API changes.

Related Question