Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

valgrind error

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
aurabindo
Posts: 20
Joined: 2013-01-03 14:34

valgrind error

#1 Post by aurabindo »

Valgrind complains about libc6-dbg when I execute valgrind --leak-check=full -v ./stuff Where stuff is made from a c code, which doesnt have string.h included

Code: Select all

==9093== Memcheck, a memory error detector
==9093== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==9093== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==9093== Command: ./stuff
==9093== 
--9093-- Valgrind options:
--9093--    --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp
--9093--    --leak-check=full
--9093--    -v
--9093-- Contents of /proc/version:
--9093--   Linux version 3.2.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.54-2
--9093-- Arch and hwcaps: AMD64, amd64-sse3-cx16
--9093-- Page sizes: currently 4096, max supported 4096
--9093-- Valgrind library directory: /usr/lib/valgrind
--9093-- Reading syms from /home/jay/devel/msp430/i2c/gen_platform/stuff (0x400000)
--9093-- Reading syms from /lib64/ld-2.13.so (0x4000000)
--9093--    object doesn't have a symbol table

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:  
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:  
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind:  
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind:  
valgrind:  Cannot continue -- exiting now.  Sorry.

But I already have libc6-dbg installed. Further, the output of

Code: Select all

whereis ld-linux-x86-64.so.2
is

Code: Select all

ld-linux-x86-64.so: /lib64/ld-linux-x86-64.so.2
Why is it complaining about strlen when I havent even included string.h in my source? What else should I do to fix this?


Thanks and Regards,
Aurabindo

tomazzi
Posts: 730
Joined: 2013-08-02 21:33

Re: valgrind error

#2 Post by tomazzi »

aurabindo wrote:Why is it complaining about strlen when I havent even included string.h in my source? What else should I do to fix this?
It is not complainning about strlen, it is complaining about missing symbol table in ld.so, which is needed to hook real program function calls and redirect them to valgrind (so You can see things like vg_replace_malloc etc in the final report). Valgrind tries to find symbols for ALL functions in the lib, because at the startup it doesn't know which of them will be used (called) by the program. It just happened that the first symbol on the list was strlen.

Now the question is what OS You are using, and if this is Debian, then how do You managed to break it that badly? :)

ooops it's Debian...

edit:
My Wheezy with kernel: Linux 3.2.0-4-amd64 is using: gcc (Debian 4.7.2-5) 4.7.2, valgrind-3.7.0, GNU ld (GNU Binutils for Debian) 2.22
Your version numbers are different, so it means that You have messed-up the system somehow.
If Your binutils are in good shape (yet) then You can verify the symbols using nm and objdump.
/edit.
Odi profanum vulgus

aurabindo
Posts: 20
Joined: 2013-01-03 14:34

Re: valgrind error

#3 Post by aurabindo »

tomazzi wrote: Now the question is what OS You are using, and if this is Debian, then how do You managed to break it that badly? :)
I dont know, I didnt intentionally break it :( I just tried to install all the possible packages having libc6 in its name. Finally apt ended up complaining "trying to overwrite /usr/include/sys/fsuid.h" while I tried installing libc6-dev-i386. However, even after moving that file to some other location (as a backup), it was complaining the same way. I then forced install with dpkg that package. By the way, its not due to this action valgrind stopped working. It never worked at the first place.

tomazzi wrote:
edit:
My Wheezy with kernel: Linux 3.2.0-4-amd64 is using: gcc (Debian 4.7.2-5) 4.7.2, valgrind-3.7.0, GNU ld (GNU Binutils for Debian) 2.22
Your version numbers are different, so it means that You have messed-up the system somehow.
If Your binutils are in good shape (yet) then You can verify the symbols using nm and objdump.
/edit.
Apparently gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.54-2 is what valgrind says my versions are, but I guess thats the version valgrind "package" was built against. Because, my uname -r says 3.2.0-4-amd64, and my gcc --version says gcc (Debian 4.7.2-5) 4.7.2, and my binutils is 2.22

Look like building valgrind from scratch is the only way left. Any other suggestions ?

tomazzi
Posts: 730
Joined: 2013-08-02 21:33

Re: valgrind error

#4 Post by tomazzi »

The only way to have valgrind not matching the rest of the system is to use repositories from other branch/distribution and/or use packages for wrong architecture. You may of course try to compile valgrind from source, but I suppose it's not the only problem with your os.
Odi profanum vulgus

Post Reply