Bug 309783

Summary: Valgrind does not support separate source and build directories
Product: [Developer tools] valgrind Reporter: Patrick J. LoPresti <lopresti>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: normal CC: flo2030, pjfloyd, tom
Priority: NOR    
Version First Reported In: 3.9.0.SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Fix configure + make in build directory distinct from source

Description Patrick J. LoPresti 2012-11-09 00:20:37 UTC
Most packages using "autoconf" allow separate source and build directories.  Like so:

  mkdir valgrind-build
  cd valgrind-build
  /path/to/valgrind-3.8.1/configure --prefix=...
  make && make install

This is useful for many reasons, like building one source tree in different ways (e.g. different platforms).

I am attaching a patch that fixes this for the basic "make + make install".  (Of course you still have to run "autogen.sh" from the source tree if you are building from SVN.)

Reproducible: Always

Steps to Reproduce:
1. cd /path/to/build/dir
2. /path/to/valgrind/source/configure
3. make
Actual Results:  
Build failure because some files are not found.

Expected Results:  
Successful build.

Simple patch attached.
Comment 1 Patrick J. LoPresti 2012-11-09 00:22:52 UTC
Created attachment 75116 [details]
Fix configure + make in build directory distinct from source

Simple patch to allow configure + make + make install to work from a separate build directory.  I am also working on a follow-up patch for "make check" and "make regtest", but this seems a natural way to break it up.
Comment 2 Tom Hughes 2012-11-09 00:29:33 UTC
Well "does not support" is a bit strong.

It is meant to, it's just that it often breaks because it's a feature that none of the core developers uses so we usually only find out we've broken it after we release it...
Comment 3 Patrick J. LoPresti 2012-11-09 00:49:14 UTC
I apologize if I titled the bug poorly.  I only meant to report an issue and provide a patch, not to insult anybody.

Fixing this for "make regtest" appears harder, since the Perl and shell scripts seem not to distinguish the source and build trees.  I am willing to do the work, but only if the maintainers agree this is worth having.  Do they?
Comment 4 Florian Krohm 2012-11-24 21:37:14 UTC
(In reply to comment #3)
> 
> Fixing this for "make regtest" appears harder, since the Perl and shell
> scripts seem not to distinguish the source and build trees.  I am willing to
> do the work, but only if the maintainers agree this is worth having.  Do
> they?

I think it's worth doing as being able to build out of tree is a reasonable expectation for many people.
Will your patch also work for a cross-build?  I'm not a autotool-wiz so am not able to say off-hand.
Comment 5 Paul Floyd 2022-12-23 16:04:47 UTC
This was fixed a while back.

*** This bug has been marked as a duplicate of bug 445211 ***