WhatLibrariesAreInstalled

From brainsik
Jump to navigation Jump to search

> I sometimes see that a program requires a particular library (like glibc > x.x). How do I find out what libraries I have on my computer already?

The easiest way is probably to use your package manager. Since I run Debian, if I wanted to know what version of libc6 I was running, I would just `dpkg -s libc6`. However, here is additional, useful, information:

        ldconfig -p

will print the list of libraries stored in your cache. Since this lists the library filenames loaded, you can run `ls -l` to see what the file is (typically) symlinked to. For example, in your list you will see the entry

        libc.so.6 (libc6) => /lib/libc.so.6

When i do `ls -l /lib/libc.so.6` it shows me that

        /lib/libc.so.6 -> libc-2.1.3.so

So I'm probably running glibc 2.1.3.

A command you might be unaware of is ldd. This lists all the libraries that a program is depending on. For example, for `ldd /bin/bash` I get

        libncurses.so.5 => /lib/libncurses.so.5 (0x40018000)
        libdl.so.2 => /lib/libdl.so.2 (0x40057000)
        libc.so.6 => /lib/libc.so.6 (0x4005b000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

The ldd command is easily mixed with the "which" command so you don't have to know where your binary is installed:

        ldd `which bash`

And of course, you can always go exploring in your various library directories to see what exists.

If anyone has better ways of going about these things, I'd love to hear about them.


Back to LinuxNotes


Last Edit: Thu, 6 Mar 2003 01:21:03 -0800
Revisions: 1