1

We run our program on a Linux virtual machine which compiles from linux-2.6.3-long-term. I want to run valgrind on that machine, and I compile from source code in the suggested way.

./configure --prefix=/tmp/valgrind/
make
make install

Then, I copy the /tmp/valgrind to my own Linux machine, I put it on the directory /data, set the environment variables:

export PATH=$PATH:/data/valgrind/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/lib64:/data/valgrind/lib
export VALGRIND_LIB=/data/valgrind/lib/valgrind

The valgrind can work, and can detect some other errors except memory leak. Here is the result of running valgrind ls -l

==2207==
==2207== Conditional jump or move depends on uninitialised value(s)
==2207==    at 0x80F3CDE: ??? (in /bin/busybox)
==2207==    by 0x80548ED: ??? (in /bin/busybox)
==2207==
==2207== Use of uninitialised value of size 4
==2207==    at 0x80D8F77: ??? (in /bin/busybox)
==2207==    by 0x8048866: ??? (in /bin/busybox)
==2207==
==2207== Conditional jump or move depends on uninitialised value(s)
==2207==    at 0x80F0F55: ??? (in /bin/busybox)
==2207==    by 0x80D8F49: ??? (in /bin/busybox)
==2207==    by 0x8048866: ??? (in /bin/busybox)
==2207==
==2207== Conditional jump or move depends on uninitialised value(s)
==2207==    at 0x80F1000: ??? (in /bin/busybox)
==2207==    by 0x80D8F49: ??? (in /bin/busybox)
==2207==    by 0x8048866: ??? (in /bin/busybox)
==2207==
==2207==
==2207== HEAP SUMMARY:
==2207==     in use at exit: 0 bytes in 0 blocks
==2207==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==2207==
==2207== All heap blocks were freed -- no leaks are possible
==2207==
==2207== For counts of detected and suppressed errors, rerun with: -v
==2207== Use --track-origins=yes to see where uninitialised values come from
==2207== ERROR SUMMARY: 2390 errors from 117 contexts (suppressed: 0 from 0)

The total heap usage is all zero. And I find someone has already meet the same problem: cross-compiled Valgrind does not detect obvious leaks Is it a known issue? The link above did not tell how to fix it, anyone know?

Community
  • 1
  • 1
frank
  • 11
  • 1
  • 1
    Are you sure you _have_ leaks? – paxdiablo Sep 05 '13 at 02:01
  • Yes, It have definitely lost. I run the same command on my ubuntu, it can report definitely lost , memoery malloc and free. – frank Sep 05 '13 at 02:02
  • Which version of Linux are you running on, compared with which version are you building on. What `valgrind` does requires it to be incredibly 'intimate' with the o/s and libraries on which it is running; I'm not sure how much difference it will tolerate. For example, `valgrind` 3.8.1 compiled and ran usefully on Mac OS X 10.7.x, but fails to be useful when run on Mac OS X 10.8.x, even when compiled on 10.8.x. Enough changed that it no longer works (which is a confounded nuisance, it must be said). Is there really a good reason not to compile `valgrind` on the machine where you'll run it? – Jonathan Leffler Sep 05 '13 at 04:21
  • Thank you for your hint, I will try to using another version linux to compile it. Because my own linux does not have compile environment, I can not compile the valgrind on my target OS. – frank Sep 05 '13 at 06:13
  • I have tried to use the same version of linux kernel to build the valgrind, it still can not work. It is too sad.:( – frank Sep 05 '13 at 08:28

0 Answers0