15

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
18

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
| improve this answer | |
  • even though @jjlin's, approach also work, I like this one better, as it's cleaner and more direct. – iomartin Dec 20 '13 at 13:00
  • 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 – SuB Jun 18 '17 at 14:34
  • 1
    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). – FeRD Jul 8 '18 at 4:13
13

You should try

 ldconfig -v | grep libnuma
| improve this answer | |
  • 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? – Sandun Feb 13 '19 at 10:51
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.