Bug 117322 - Build fails when srcdir != builddir
Summary: Build fails when srcdir != builddir
Status: RESOLVED DUPLICATE of bug 155913
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.1.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-30 03:33 UTC by Daniel Richard G.
Modified: 2009-07-01 09:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch against valgrind-3.1.0 sources (15.60 KB, patch)
2005-11-30 03:37 UTC, Daniel Richard G.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Richard G. 2005-11-30 03:33:57 UTC
Valgrind does not build in an out-of-source-tree configuration. I will attach a 
patch that addresses this, by way of the following issues: 
 
1. libvex_guest_offsets.h is required by "make dist", yet no rule exists to 
build it if it is missing. Added. 
 
2. The add_includes_{x86,amd64,ppc32}_linux variables do not include 
-I$(top_builddir), so the compiler can't find the Autoconf-generated config.h 
header. Included. 
 
3. The VEX library is completely unaware of the possibility of a remote-srcdir 
build. Numerous edits have rectified this situation. 
 
4. DISTCHECK_CONFIGURE_FLAGS passes a --with-vex option even if you didn't do 
so when configuring the source. (This causes "make distcheck" to fail when it 
can't find ./VEX in _build.) Conditionalized.
Comment 1 Daniel Richard G. 2005-11-30 03:37:48 UTC
Created attachment 13680 [details]
Patch against valgrind-3.1.0 sources

Both in- and out-of-source-tree builds work for me with this patch. Feel free
to change my choice of variable names et al.; consistency wasn't foremost on my
mind :-)
Comment 2 Daniel Richard G. 2007-01-27 04:57:51 UTC
Building the latest valgrind-3.2.2:

...
gcc -I/home/src/valgrind/valgrind-3.2.2/coregrind -I/home/src/valgrind/valgrind-3.2.2 -I/home/src/valgrind/valgrind-3.2.2/coregrind/x86 -I/home/src/valgrind/valgrind-3.2.2/coregrind/linux -I/home/src/valgrind/valgrind-3.2.2/coregrind/x86-linux -I/home/src/valgrind/valgrind-3.2.2/include -I/home/src/valgrind/valgrind-3.2.2/VEX/pub -DVG_PLATFORM="\"x86-linux\"" -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -m32 -g -Wno-long-long -c -o libcoregrind_x86_linux_a-m_cpuid.o `test -f 'm_cpuid.S' || echo '/home/src/valgrind/valgrind-3.2.2/coregrind/'`m_cpuid.S
In file included from /home/src/valgrind/valgrind-3.2.2/coregrind/m_cpuid.S:31:
/home/src/valgrind/valgrind-3.2.2/coregrind/pub_core_basics_asm.h:45:20: error: config.h: No such file or directory
make[3]: *** [libcoregrind_x86_linux_a-m_cpuid.o] Error 1
make[3]: Leaving directory `/tmp/vg-build/coregrind'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/vg-build/coregrind'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/vg-build'
make: *** [all] Error 2

The bug lives on.
Comment 3 Frederik Heber 2008-05-21 11:05:08 UTC
For me its standard practice to create a dir like 'build64' in the topdir and execute the configure script therein.
This srcdir!=builddir bug is still present in 3.3.0. I stumbled over point 2. with a missing config.h due to $(top_builddir) not present in the add_includes_... (AMD_64 in my case), and furtheron libmpiwrap was then also missing as it could not be found.

Comment 4 Nicholas Nethercote 2009-07-01 09:13:12 UTC

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