1

While trying to debug something, i noticed that ldd <executable> would show a bunch of libraries like libldap_r, libkrb5 and libroken, amongst others. On the other hand a rabin2 -l <executable> does not show the same set of libraries.

I've grepped through the source directory for ldap strings from linking or function calls but they don't show up, implying that these libraries shouldn't be linked in anyway. What should i do to find out if the libraries are being used?

muru
  • 72,889

1 Answers1

2

rabin2 -l shows a binary’s direct dependencies, i.e. those that are listed in the binary itself. ldd shows a binary’s fully-resolved dependency tree (as far as possible); this includes transitive dependencies. Thus if a binary needs liba and libb, and liba needs libd which itself needs libe, rabin2 -l will only list liba and libb, whereas ldd will show all four libraries (if they are all available).

You can match ldd’s result manually using rabin2 -l by listing the first binary’s dependencies, then each individual dependency’s dependencies, and so on until no new dependency is identified.

To find out if a library is actually being used, you can the binary with ltrace in all the scenarios you care about. This will identify the library functions that are called. Note that the use of certain libraries will be configuration-dependent; for example the Kerberos libraries would presumably only be used if Kerberos is configured.

See also ldd vs rpm -q --requires.

Stephen Kitt
  • 434,908