Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to run a Unix program which runs for a few seconds, without sacrificing speed of execution. After it is done, I would like to know what dynamic (shared) libraries it used.

What is the appropriate command?

The main problem is that I have a handful of BLAS implementations, and I want to figure out exactly which one is being used by each of a handful of different programs.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Lastly, you could use strace. strace <program_to_execute will give you a ton of info, including calls to libraries. It's not nearly as clean as the other answers, but it's another way of doing things. (and useful in its own right)


--Christopher Karel

share|improve this answer

Using ldd you can see the dynamic libraries that are linked to a specific binary file.

Like so:

$ ldd /usr/bin/wget
    linux-vdso.so.1 =>  (0x00007fffa5dff000)
    libssl.so.0.9.8 => /lib/libssl.so.0.9.8 (0x00007f4d3280e000)
    libcrypto.so.0.9.8 => /lib/libcrypto.so.0.9.8 (0x00007f4d3247e000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f4d32279000)
    librt.so.1 => /lib/librt.so.1 (0x00007f4d32071000)
    libc.so.6 => /lib/libc.so.6 (0x00007f4d31cef000)
    libz.so.1 => /lib/libz.so.1 (0x00007f4d31ad7000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4d32a73000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4d318ba000)
share|improve this answer

In addition to ldd, cat /proc/$pid/maps will show you which libraries have been mapped into memory, including dynamic ones loaded after program start (and deleted items too)

share|improve this answer
    
I should add, the program needs to be running -- you mention your runs are only a few seconds, you may need to suspend your program, or just be quick w/ the cat /proc/$pid/maps –  Jason Jun 23 '10 at 2:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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