Starting with (I think) valgrind 2.1.2, valgrind no longer finds shared libraries via the rpath embedded in the executable if it contains a reference to $ORIGIN. Valgrind 2.0 worked, and I've also tested 2.2.0, which does not work. If the embedded path is absolute (does not use $ORIGIN), it works fine. Example: shared.c: int foo() { return 42; } test.c: extern int foo(); int main() { return foo(); } $ cd /tmp $ gcc -shared shared.c -o libshared.so $ gcc test.c -o test -L. -lshared -Wl,-rpath,'$ORIGIN' $ cd ~ $ ldd /tmp/test $ /tmp/test $ valgrind --tool=memcheck /tmp/test My system: $ uname -a Linux topgun 2.6.8-1-mts #8 Mon Aug 16 15:42:31 EDT 2004 i686 Pentium III (Coppermine) unknown GNU/Linux $ valgrind --version valgrind-2.2.0 $ gcc --version gcc (GCC) 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)
This happens because glibc does a readlink on /proc/self/exe in order to resolve $ORIGIN for an executable and as we know from bug 86921 that doesn't work under valgrind. *** This bug has been marked as a duplicate of 86921 ***