Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valgrind: fatal error: memcheck.h: No such file or directory

Tags:

c++

valgrind

We are trying to track down a Conditional jump or move depends on uninitialised value in a C++ project reported by Valgrind. The address provided in the finding is not really helpful because it points to the end of a GCC extended assembly block, and not the actual variable causing the trouble.

According to the Valgrind's Eliminating undefined values with Valgrind, the easy way, we can use VALGRIND_CHECK_MEM_IS_DEFINED or VALGRIND_CHECK_VALUE_IS_DEFINED after including <memcheck.h>. Additionally, those macros or functions are apparently documented in the header file (there is definitely no man page for them).

However, when I include <memcheck.h> or <valgrind/memcheck.h>, it results in:

fatal error: memcheck.h: No such file or directory

Based on Stack Overflow's How do I find which rpm package supplies a file I'm looking for?, I performed a RPM file search, but its returning 0 hits for memcheck.h.

QUESTIONS

  1. The blog article is a bit dated. Does the information still apply?

  2. If the information is accurate, then where do I find memcheck.h?


$ uname -a
Linux localhost.localdomain 4.1.4-200.fc22.x86_64 #1 SMP Tue Aug 4 03:22:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ g++ --version
g++ (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)
...

$ valgrind --version
valgrind-3.10.1
like image 272
jww Avatar asked Aug 17 '15 10:08

jww


1 Answers

You have to install the RPM valgrind-devel which contains memcheck.h.

The *-devel packages are typically located in the "optional" repositories (e.g. rhel-x86_64-server-optional-6 on RHEL 6). Also, you can find the RPM on Google, download it, and install it on its own. With either approach, memcheck.h is typically placed in /usr/include/valgrind once installed.

like image 63
Paolo Brandoli Avatar answered Sep 28 '22 10:09

Paolo Brandoli