Getting Valgrind to build on Debian 5.0.3

I’ve been trying this already several times over the last three months, but always failed to build the latest Valgrind from sources on my Debian box. At last I had success.

The problem appears to be that for some unknown reasons GNU Make (or one of its callees, e.g. the shell?!) acts up on cd $$subdir which is used in numerous places in the Makefiles in the source tree. This is taken from the make files, so it will collapse to cd $subdir before the shell gets to see it. $subdir is in most cases a variable in a for loop, iterating over subdirectories of the “current” one. Strangely enough all seemed right, the include subdirectory exists, it contains a Makefile and so on. I even inserted some additional commands before the cd in order to get some diagnostic output. The output of pwd suggested that we were in the right folder, the value of $subdir was correct and all side conditions seemed in order. But still, it wouldn’t build.

So I used the dirty trick (also archived in the valgrind-users mailing list) to modify the Makefile.in files to replace all occurrences of cd $$subdir with cd $(CURDIR)/$$subdir and suddenly everything worked after running configure again. Magic … 😉

Here’s the line I used:

find -name 'Makefile.in' -exec \
  sed -i 's/cd \$\$subdir/cd \$(CURDIR)\/\$\$subdir/' {} \;

That took care of it for me. So I’m a happy Valgrind 3.5.0 user now, instead of using 3.3.1 as it comes with Debian 5.0.3.

// Oliver

PS: The reason why we replace it in Makefile.in is that this way running configure again will not undo our modifications, because those files are used to create the actual Makefiles.

This entry was posted in EN, Linux, Programming, Unix and unixoid and tagged , , , . Bookmark the permalink.

3 Responses to Getting Valgrind to build on Debian 5.0.3

  1. Pingback: Getting Valgrind to build on Debian 5.0.3 | Debian-News.net - Your one stop for news about Debian

  2. Tom says:

    strange, I’ve never had problems compiling it!
    you should really use valkyrie too, unfortunately it only works with 3.4 for now, not 3.5.

  3. Oliver says:

    See the next post “Not Valgrind, CDPATH” – it explains the cause.

Leave a Reply

Your email address will not be published. Required fields are marked *