Due to using Gentoo, it often happens that after an update programs are linked against old versions of libraries. Normally, revdep-rebuild helps resolving that, but this time it's a dependency on a python library, and python-updater
won't pick it up.
Is there a "hierarchical" variant of ldd
which shows me what shared library depends on which another shared library? Most of the time libraries and executables are linked only against a handful of other shared libraries, which in turn were linked against a handful, turning the library dependency into a big list. I want to know which dependency I've got to rebuild with the new version of another library that I upgraded.
I see many interesting details but no direct answer to the question asked.
The 'hierarchical' version of
ldd
islddtree
(fromapp-misc/pax-utils
):If you are running Portage≥2.2 with
FEATURES=preserve-libs
, you should rarely ever needrevdep-rebuild
anymore as old.so.
vers will be preserved as needed (though you still need to rebuild carefully, as stuff still goes kaboom whenlibA.so.0
wantslibC.so.0
andlibB.so.0
wantslibC.so.1
and some binary wants bothlibA.so.0
andlibB.so.0
).That being said, what
ldd
does is to get the dynamic linker to do load the executable or library as it usually would, but print out some info along the way. This is a recursive "binary needs library needs other library&hellip" search, because that's what the dynamic linker does.I'm currently running Linux/ppc32; on Linux/x86, the dynamic linker is usually
/lib/ld-linux.so.2
, and on Linux/x86_64, the dynamic linker is usually/lib/ld-linux-x86-64.so.2
. Here, I call it directly just to hammer in the point that allldd
is nothing more than a shell script that calls upon the dynamic linker to perform its magic./sbin/badblocks
doesn't listlibpthread.so.0
as a library dependency, but it gets pulled in bylibcom_err.so.2
.Is your problem that
ldd
doesn't output a nice-looking dependency tree? Useldd -v
.If you want, you can read the ELF headers directly instead of depending on the dynamic linker.
You can also
man ld.so
for other cute tricks you can play withglibc
's dynamic linker.I needed something like this, so I wrote
tldd
, here it is showing its own library dependencies:I was also going to suggest "readelf -d" but also ensure you build with LDFLAGS="-Wl,--as-needed" if you don't already. This will make you hit this problem less often. Portage 2.2's preserve-libs is nice but I gather it was masked primarily because of it - it does have flaws.