On Wed, Aug 08, 2007 at 01:42:25PM -0700, Stephen Lau wrote:
> rps wrote:
>
> > Is there any way to findout what all the libraries my program is
> > using. I use 'nm' to find out names from the object file but I dont
> > have any idea to findout libraries used by my prog.
>
> ldd
Note that ldd will return all libraries that are needed not only by your
program, but by any libraries needed by the libraries your program needs,
and so on, recursively.
Another useful tool here is elfdump, which can tell you all sorts of
wonderful things about an elf binary, but in this case can tell you what
your program is asking for directly:
% elfdump -d /sbin/zfs
Dynamic Section: .dynamic
index tag value
[0] NEEDED 0xb3e libzfs.so.1
[1] NEEDED 0xb5a libuutil.so.1
[2] NEEDED 0xb68 libumem.so.1
[3] NEEDED 0xb7e libnvpair.so.1
[4] NEEDED 0xb98 libc.so.1
[ ... ]
The "NEEDED" lines refer to the SONAMEs of the objects your program is
linked against.
Note that if your program loads any libraries via dlopen(), but didn't
specify them on the link-edit line (i.e., "cc/ld ... -lzfs"), then they
won't show up either here or when using ldd.
Danek
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code