Not sure if it's a bug or not, but the libstdc++.so stuff seems wrong like if ld.so.conf dirs were read from bottom to top instead of from top to bottom: $ scanelf -L -n /usr/lib64/librubberband.so.2.0.0 TYPE NEEDED FILE ET_DYN /usr/lib/libsamplerate.so.0,/usr/lib/libfftw3.so.3,/lib/libpthread.so.0,/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/libstdc++.so.6,/lib/libm.so.6,/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/libgcc_s.so.1,/lib/libc.so.6 /usr/lib64/librubberband.so.2.0.0 $ ldd /usr/lib64/librubberband.so.2.0.0 linux-vdso.so.1 => (0x00007fff1effd000) libsamplerate.so.0 => /usr/lib/libsamplerate.so.0 (0x00007fbe16a00000) libfftw3.so.3 => /usr/lib/libfftw3.so.3 (0x00007fbe1668e000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007fbe16471000) libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libstdc++.so.6 (0x00007fbe16165000) libm.so.6 => /lib/libm.so.6 (0x00007fbe15ee2000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fbe15cca000) libc.so.6 => /lib/libc.so.6 (0x00007fbe15975000) /lib64/ld-linux-x86-64.so.2 (0x00007fbe16fc7000) $ cat /etc/ld.so.conf # ld.so.conf autogenerated by env-update; make all changes to # contents of /etc/env.d directory /usr/local/lib //usr/lib32/opengl/xorg-x11/lib //usr/lib64/opengl/xorg-x11/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /usr/x86_64-pc-linux-gnu/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3 /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/32 /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2 /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/32 /usr/lib64/nspr /usr/lib64/nss /usr/lib/qt4 /usr/lib64/qt4 /usr/lib32/qt4 /usr/kde/3.5/lib /usr/kde/3.5/lib64 /usr/kde/3.5/lib32 /usr/qt/3/lib /usr/qt/3/lib64 /usr/qt/3/lib32 /usr/lib64/postgresql-8.3/lib64 /opt/xulrunner /usr/games/lib /usr/games/lib64 /usr/games/lib32 /usr/lib64/fltk-1.1 /usr/lib32/libstdc++-v3/ scanelf -L -n tells its gcc 4.1's libstdc++ that is used while I have gcc 4.3 as default compiler.
it is a bug ... ld.so.conf should be processed from top to bottom, not the other way around
the ld.so.cache lookup function would return the last match rather than the first. so i cleaned it up and changed it to return the first match. should be faster too ;). http://sources.gentoo.org/gentoo-projects/pax-utils/scanelf.c?r1=1.211&r2=1.212