Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install valgrind properly?

Tags:

linux

valgrind

I'm installing valgrind now, until the ‘make install’ command it goes good. The next command- ‘make regtest’ outputs the next error:

../../depcomp: line 689: exec: g++: not found
make[5]: *** [leak_cpp_interior.o] Error 127
make[5]: Leaving directory `/home/kbubuntu/valgrind-3.9.0/memcheck/tests'
make[4]: *** [check-am] Error 2
make[4]: Leaving directory `/home/kbubuntu/valgrind-3.9.0/memcheck/tests'
make[3]: *** [check-recursive] Error 1
make[3]: Leaving directory `/home/kbubuntu/valgrind-3.9.0/memcheck/tests'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/home/kbubuntu/valgrind-3.9.0/memcheck'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/kbubuntu/valgrind-3.9.0'
make: *** [check] Error 2

How can I solve it?

Thanks.

like image 518
Shtrudle Avatar asked Jul 24 '14 13:07

Shtrudle


People also ask

How to install Valgrind on Ubuntu?

Valgrind installation steps. 1 Pull Valgrind source archive file to get the source. 2 Unpack the archive to extract the files onto your system. 3 Run “ ./configure” command to prepare build configurations. 4 Use the make command to start the build, just like you use to do. 5 Run <sudo make install> to install it onto your system. More ...

What is Valgrind and how to use it?

What is Valgrind? It is an open source framework, popular code profiling, and leak checker tool. You can instantly use it to detect dynamic memory and threading bugs, and profile application in detail. Alternatively, you can utilize it to develop new tools.

What is code profiling in Valgrind?

Code Profiling Using Valgrind. Code profiling is an essential facet of programming. Some of you may already know about code profiling yet few of us could wonder what it is. Code profiling is the process to determine which part of the program is depleting resources.

What is suppression in Valgrind?

So Valgrind brings the concept of suppression to hide such errors which are outside of your purview, or you do not want to see. Steps for suppression. 1. Run your program using the following command.


3 Answers

Short answer: Make from source.

How?

  1. Uninstall the non working valgrind version with root rights (eg. sudo):

apt-get --purge valgrind or dpkg --remove valgrind or yum remove valgrind

  1. Obtain sources from here.

  2. Identify the latest version (for example 3.17.0)

  3. Download sources : wget https://sourceware.org/pub/valgrind/valgrind-3.17.0.tar.bz2

  4. Decompress archive tar xvf valgrind-3.17.0.tar.bz2

  5. Go to uncompressed archive cd valgrind-3.17.0

  6. Configure ./configure

  7. Compile make

  8. Install make install (with root rights, eg. sudo)

Note: very useful for Raspberry Pi 4 users - Default valgrind installation generate a lot of internal errors. See Valgrind reports hundreds of errors in Hello World program on RaspberryPi 4B

like image 51
g10guang Avatar answered Nov 08 '22 23:11

g10guang


All major linux distributions will include valgrind in their repositories. You can find this on debian derived, apt based systems with:

apt search valgrind

But first just try:

apt install valgrind

It should work, and pull in any dependencies. Remember, if you are not the superuser, you'll need to preface those with sudo.

It's a great tool, have fun.

like image 25
CodeClown42 Avatar answered Nov 09 '22 01:11

CodeClown42


i think its due to dependency not met. install g++ by

sudo apt-get install g++

then try again. error is due to exec is unable to find any package named g++

like image 36
shiv garg Avatar answered Nov 09 '22 00:11

shiv garg