How to check currently used libraries from command line ?

Home » Asterisk Users » How to check currently used libraries from command line ?
Asterisk Users 5 Comments


I’ve recently upgraded a system from 1.8 to asterisk 10 and also
updated spandsp while doing so.
I wondered what is the safest and easiest way to check from command
line which libraries a running Asterisk system is currently using
(just like “dahdi show version”, for instance).

Though I’m currently asking this for spandsp, this question is on a
more general plan (for example, which ssl library am I currently using

Suggestions ?


5 thoughts on - How to check currently used libraries from command line ?

  • Hi Olivier,

    I suppose you give “strace” a try.
    It’s a powerful debugging utility, you should be able to find everything
    you are looking for.

    best regards,

    Am 16.01.2012 11:14, schrieb Olivier:

  • 2012/1/16, Anton Kvashenkin :

    Thanks for replying.

    I got this:
    # ldd /usr/sbin/asterisk => (0xb7886000) => /usr/lib/i686/cmov/ (0xb7834000) => /usr/lib/i686/cmov/ (0xb76dc000) => /lib/i686/cmov/ (0xb7595000) => /usr/lib/ (0xb746b000) => /usr/lib/ (0xb73df000) => /lib/i686/cmov/ (0xb73db000) => /lib/i686/cmov/ (0xb73c2000) => /lib/ (0xb7387000) => /lib/i686/cmov/ (0xb7361000) => /lib/i686/cmov/ (0xb734d000) => /usr/lib/ (0xb7339000)
    /lib/ (0xb7887000)
    # ldd /usr/lib/ => (0xb77a1000) => /usr/lib/ (0xb769b000) => /lib/i686/cmov/ (0xb7675000) => /lib/i686/cmov/ (0xb752e000) => /usr/lib/ (0xb750e000) => /usr/lib/ (0xb74fa000)
    /lib/ (0xb77a2000)

    So, with those 2 commands, I couldn’t directly check the link between
    asterisk and spandsp, and check am I’m really using spandsp0.0.6pre18.

  • To find out which libraries a particular binary executable program is linked
    against, you just need to do

    $ ldd /path/to/executable

    You can find the actual path to an executable by typing

    $ which foo

    Replace foo by the name of the executable about which you want information,

    Now, because we usually want the computer to do as much of the hard work for
    us as possible, we can use the $(command) operator — which treats whatever is
    between the brackets as a command, runs it and substitutes its output into the
    command which it was part of — to combine these two commands into one:

    $ ldd $(which foo)

    i.e. it will run “which foo”, and then do “ldd” on whatever output “which foo”

    Trivial example below:

    $ ldd $(which ls) => (0x00007fffa7974000) => /lib/ (0x00007fdc03188000) => /lib/ (0x00007fdc02f80000) => /lib/ (0x00007fdc02d78000) => /lib/ (0x00007fdc02a17000) => /lib/ (0x00007fdc02813000)
    /lib64/ (0x00007fdc033ce000) => /lib/ (0x00007fdc025f6000) => /lib/ (0x00007fdc023f2000)

    Hmm, that’s a whole lot of libraries just to get a directory listing! Not
    surprisingly, busybox gets away with rather less:

    $ ldd $(which busybox) => (0x00007fff2b7ff000) => /lib/ (0x00007f04a8217000) => /lib/ (0x00007f04a7eb6000)
    /lib64/ (0x00007f04a84c1000)

    Note1: Here we see 16 hex digits after each library name, indicating a 64-bit
    system. On a 32-bit system, we would see only 8 hex digits after each library

    Note2: Programs that sometimes or always crash, may be missing a library. If
    so, this will be obvious when you run ldd.

  • To see the actual memory map of the process:


    Code is mapped from files, and thus you’ll see the original files.
    You’ll probably need to remove duplicates and such.

    Note that ldd of /usr/sbin/asterisk will not give you libraries of the
    various modules. For that you’ll have to run ldd on the specific