Created attachment 143375 [details] patch to fix out of tree builds Yocto project has been carrying this patch for a while; I believe this allows building valgrind in a separate build directory:
This looks OK but the patch needs updating for the FreeBSD suppressions.
Created attachment 143477 [details] v2 with requested adjustments
I'll try to test the patch this week and then get back to you.
This fails for mpi (with a 'build' directory in the Valgrind srcdir) In file included from ../../mpi/libmpiwrap.c:99: ../../mpi/../memcheck/memcheck.h:72:10: fatal error: 'valgrind.h' file not found #include "valgrind.h" ^~~~~~~~~~~~ 1 error generated. gmake[2]: *** [Makefile:747: libmpiwrap_amd64_freebsd_so-libmpiwrap.o] Error 1 gmake[2]: Leaving directory '/usr/home/paulf/scratch/valgrind/build/mpi' gmake[1]: *** [Makefile:897: all-recursive] Error 1 gmake[1]: Leaving directory '/usr/home/paulf/scratch/valgrind/build' gmake: *** [Makefile:760: all] Error 2 It might work by accident if I had the Valgrind package installed. The problem seems to be that valgrind.h is generated from a .in file, so is in ../include relative to build/mpi Perhaps mpi/Makefile.am:libmpiwrap_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS = -I$(top_srcdir)/include should be -I $(top_builddir) ?
Created attachment 143897 [details] v3 with requested adjustments Thanks, adjusted patch attached.
Sorry for the long delay. "gmake" now seems OK in the out of tree directory, but if I run "gmake check" then I get gmake[3]: Entering directory '/usr/home/paulf/scratch/valgrind/build/docs' gmake[3]: *** No rule to make target '../../docs/xml/vg-entities.xml', needed by 'valid-manual'. Stop. gmake[3]: Leaving directory '/usr/home/paulf/scratch/valgrind/build/docs' gmake[2]: *** [Makefile:555: check-am] Error 2 gmake[2]: Leaving directory '/usr/home/paulf/scratch/valgrind/build/docs' gmake[1]: *** [Makefile:897: check-recursive] Error 1 gmake[1]: Leaving directory '/usr/home/paulf/scratch/valgrind/build' gmake: *** [Makefile:1196: check] Error 2
Created attachment 147953 [details] v4 with doc fix This is now corrected too :)
I still have problems with the docs directory. I'll see if Mark W has time to take a look.
I believe you need to re-run autogen.sh. Somehow automake didn't re-do the makefiles with this change for me :-/
The supp and mpi changes look correct. Thanks. I also got an issue with the generated vg-entities.xml. But this was solved by running autoreconf -f instead of ./autogen.sh which I don't fully understand.
(In reply to Mark Wielaard from comment #10) > I also got an issue with the generated vg-entities.xml. > But this was solved by running autoreconf -f instead of ./autogen.sh which I > don't fully understand. Nope, that was just me being silly and then doing a srcdir == builddir build The issue occurs during xmllint checking from make check: Making check in docs make[2]: Entering directory '/tmp/valgrind-obj/docs' make check-local make[3]: Entering directory '/tmp/valgrind-obj/docs' if type xmllint 2>/dev/null; then \ xmllint --noblanks --noout --xinclude --postvalid --noent ../../valgrind/docs/xml/index.xml && \ touch valid-manual; \ fi xmllint is /usr/bin/xmllint ../../valgrind/docs/xml/index.xml:4: warning: failed to load external entity "../../valgrind/docs/xml/vg-entities.xml" [ <!ENTITY % vg-entities SYSTEM "vg-entities.xml"> %vg-entities; ]> ^ ../../valgrind/docs/xml/index.xml:11: parser error : Entity 'rel-type' not defined <releaseinfo>&rel-type; &rel-version; &rel-date;</releaseinfo>
So we were missing a few more search path, but the following seems to make document generation work again with srcdir != builddir --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -124,11 +124,12 @@ LOGFILE = print.log # validation stuff XMLLINT = xmllint -XMLLINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent +XMLLINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent \ + --path $(top_builddir)/docs/xml # stylesheet processor XSLTPROC = xsltproc -XSLTPROC_FLAGS = --nonet --xinclude +XSLTPROC_FLAGS = --nonet --xinclude --path $(top_builddir)/docs/xml # stylesheets XSL_HTML_CHUNK_STYLE = $(mylibdir)/vg-html-chunk.xsl @@ -238,7 +239,8 @@ print-docs: cp $(myimgdir)/*.png $(myprintdir)/images && \ xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \ -x $(XSL_FO_STYLE) \ - --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE) && \ + --searchpath $(top_builddir)/docs/xml:print \ + pdf $(myxmldir)/index.xml &> $(LOGFILE) && \ echo "Generating PS file: $(myprintdir)/index.ps ..." && \ pdftops index.pdf && \ mv index.pdf index.ps $(myprintdir) && \ @@ -353,7 +355,8 @@ download-docs: cp $(myimgdir)/*.png $(vgdir)/print/images/ xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \ -x $(XSL_FO_STYLE) \ - --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE) + --searchpath $(top_builddir)/docs/xml:print \ + pdf $(myxmldir)/index.xml &> $(LOGFILE) mv index.pdf $(vgdir)/print/manual.pdf @echo "" @echo "Generating valgrind_manual.ps.bz2 ..."
Thanks, it works fine now with the new search paths. Pushed as: commit 2c0fb665699309e1e02a02084324748f46a6c788 Author: Randy MacLeod <Randy.MacLeod@windriver.com> Date: Tue Oct 16 21:01:04 2018 -0400 Fix out of tree builds. The paths to these files need to be fully specified in the out of tree build case. glibc-2.X.supp is a generated file so the full path is deliberately not specified in that case. Also adjust the mpi include dir location as valgrind.h is generated as well and needs to be taken out of build dir. Also adjust the location of generated xml file. And the search paths for the xmllint, xsltproc and xmlto programs. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Checked on FreeBSD, gmake and gmake check now both work out of tree.
Been fixed for a while.
*** Bug 309783 has been marked as a duplicate of this bug. ***