a way to know which libraries are being used

Asked by Hans van den Bogert

Is there a way you can start a program and see which libraries are being loaded.
The scenario
- I have a program from the internet namely openftd as tar.gz (but that doesn't matter much)
- I compiled it.
- I have made a deb package of the binaries with checkinstall.
- When I send other people this package the program (ofcourse) starts to complain that it can't find the necessary libraries.

Now I can't check this easily because I have all the necessary libraries installed, so I get no errors. Is there a common way to solve this so I can add the dependencies to the .deb package?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Hans van den Bogert
Solved:
Last query:
Last reply:
Revision history for this message
Artem Popov (artfwo) said :
#1

Usually, this is performed by the ldd utility:

$ ldd /usr/bin/alsamixer
 linux-gate.so.1 => (0xb7f41000)
 libncurses.so.5 => /lib/libncurses.so.5 (0xb7efd000)
 libasound.so.2 => /usr/lib/libasound.so.2 (0xb7e3a000)
 libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7e14000)
 libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7e10000)
 libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7df8000)
 libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ca9000)
 /lib/ld-linux.so.2 (0xb7f42000)

But in your case, you'll have to manually find the deb-packages for the listed libraries (e. g. by using dpkg -S libncurses.so.5).

In order to fully automate the discovery of library dependencies, consider building some "proper" Debian packages for your software. That requires quite a bit of effort, but is rewarding anyway. Check the packaging guide to get started:

https://wiki.ubuntu.com/PackagingGuide

Revision history for this message
Hans van den Bogert (hbogert) said :
#2

thanks!

precisely what I wanted.