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.
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 :-)
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.
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.
*** This bug has been marked as a duplicate of bug 155913 ***