Ubuntu: valgrind: failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory
Asked Answered
M

9

8

I have installed valgrind with no problems but when running it I keep getting the following error:

valgrind: failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory

I have adjusted my bash file accordingly. I added the following path: /usr/bin/valgrind from using: which valgrind command and it's still not working. Then I added the path:/usr/lib/valgrind and it is still not working. I think I am confused about the correct local directory for using Ubuntu.

I am using:

export VALGRIND_LIB="/usr/lib/valgrind"

Do I have to add my local directory first?

Mohl answered 12/11, 2020 at 23:11 Comment(0)
E
9

add "export VALGRIND_LIB=/usr/lib/valgrind/"(or /usr/local/lib/valgrind/ or other place where you install your valgrind lib) into ~/.bashrc

Esquibel answered 21/1, 2021 at 10:17 Comment(1)
This does not work with 3.17.0. See @paul Floyd answer.Bobbiebobbin
F
18

I built valgrind from source and the posted answer did not work for me but this did:

e.g. how i configured:

./configure --prefix=$HOME/local/valgrind

What I added to my ~/.bashrc

export VALGRIND_LIB=$HOME/local/valgrind/libexec/valgrind

Seems like it needed libexec, not lib

Frug answered 25/8, 2021 at 22:30 Comment(2)
This is what worked for me.Bellbottoms
For some reason, when I got 3.16.1 going in my arm/linux environment, /opt/lib/valgrind/ did the trick. Upgrading to 3.20.0, for some reason this error popped up and I had to edit my export to /opt/libexec/valgrind/Pharmacy
E
9

add "export VALGRIND_LIB=/usr/lib/valgrind/"(or /usr/local/lib/valgrind/ or other place where you install your valgrind lib) into ~/.bashrc

Esquibel answered 21/1, 2021 at 10:17 Comment(1)
This does not work with 3.17.0. See @paul Floyd answer.Bobbiebobbin
D
0

You shouldn't need to set any environment variables, unless you are working on the code of Valgrind itself.

Just run /usr/bin/valgrind. This will then run /usr/lib/valgrind/memcheck-amd64-linux and preload some .so files in the same directory.

I don't have much experience with Debian/Ubuntu, but if you installed it with snap then afaict you should use the --classic option.

Durward answered 13/11, 2020 at 15:54 Comment(2)
I have confirmed that this fixes running with valgrind/3.17.0. All that it is needed is the $PATH set, not VALGRIND_LIB. Setting VALGRIND_LIB breaks it. With valgrind/3.15.0, the VALGRIND_LIB might be needed.Bobbiebobbin
@MarkLakata set the $PATH to what exactly?Lucio
H
0
export VALGRIND_LIB=<where libexec/valgrind is|where massif-arm64-linux is>
Homelike answered 29/4, 2021 at 17:9 Comment(0)
I
0

Also make sure you are using a 64bit valgrind for 64 bit executable, using a 32 bit valgrind on a 64 bit exe resuts in this error

/tmp>file /usr/bin/valgrind /usr/bin/valgrind: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

/tmp>file a.out a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

/tmp>valgrind a.out valgrind: failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory

Incogitable answered 17/8, 2021 at 16:16 Comment(0)
S
0

As the others indicated above, you need export VALGRIND_LIB="path-to-valgrind-lib". If "/usr/lib/valgrind" or "/usr/local/lib/valgrind" does not work, check "/usr/lib/x86_64-linux-gnu/valgrind" too if you are on linux.

Sutter answered 19/7, 2022 at 13:11 Comment(0)
A
0

None of the solutions proposed worked for me, so I enabled all optional modules:

./configure --enable-only64bit --enable-inner --enable-lto --enable-tls

et voila, it worked.

Assignment answered 1/3, 2023 at 10:8 Comment(0)
M
0

This error is seen when 32 bit valgrind is used for 64 bit executable. Install 64 bit version of valgrind to resolve the issue.

yum install valgrind.x86_64
Monocycle answered 5/6, 2023 at 9:19 Comment(0)
H
-2

Try to run using "sudo", in my case it helped.

Heracliteanism answered 19/5, 2021 at 8:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.