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?


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.

  • Guess everything needs libc – muru Mar 31 at 7:19
  • 1
    I skipped it to avoid confusion ;-). – Stephen Kitt Mar 31 at 7:19
  • Great! I thought so, but didn't find any answers to this question when searching the web. – placid chat Mar 31 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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