<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 17, 2022 at 11:42 AM Michael Stahl <<a href="mailto:mst@libreoffice.org">mst@libreoffice.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 13.05.22 16:42, Maarten Hoes wrote:<br>
> So to sum it up, with only gcc installed, the gcov build works if I modify :<br>
> <br>
> external/expat/ExternalProject_expat.mk<br>
> external/liborcus/ExternalProject_liborcus.mk<br>
> <br>
> and add :<br>
> <br>
> CFLAGS += -fprofile-arcs -ftest-coverage<br>
> CXXFLAGS += -fprofile-arcs -ftest-coverage<br>
> LDFLAGS += -fprofile-arcs -lgcov<br>
> <br>
> to the top of them. Of course, that does not seem to be a proper <br>
> permanent solution to the issue: the question remains why these *FLAGS <br>
> don't end up in these 2 files when you specify 'gb_GCOV=YES make'. <br>
<br>
also, there is another problem: setting global variables like this will <br>
affect *all* makefiles, which may or may not be what you intend - it's <br>
certainly bad style to do it from a local makefile.<br></blockquote><div><br></div><div>What basically is intended, is that all of LibreOffice gets compiled with gcov code coverage magic included, which I believe indeed translates to 'all' makefiles. But I already got the idea that the way I modified those makefiles was a terrible way to do things; it's just that this seemed the quickest/easiest way (from my point of view, considering my inexperience with makefiles) to test things out, without having to take the deep dive into the build system and the makefiles.</div><div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> Pointers to where I should start looking in the build system in an <br>
> attempt to troubleshoot things are appreciated. I found the point where <br>
> the flags are supposed to be set conditionally in lines 112-117 in <br>
> 'solenv/gbuild/platform/com_GCC_defs.mk' , but don't really know how to <br>
> proceed from there. Perhaps the variables <br>
> "gb_CFLAGS_COMMON/gb_CXXFLAGS_COMMON/gb_LinkTarget_LDFLAGS" are not used <br>
> in the right places, or overwritten with something else ?<br>
<br>
the global *FLAGS variables should be in <a href="http://config_host.mk" rel="noreferrer" target="_blank">config_host.mk</a>, set from <br>
configure script.<br>
<br>
often the best way to set *FLAGS locally is to pass them to the <br>
configure invocation in an ExternalProject*.mk, taking care not to mess <br>
up make's terrible syntax (like \ EOL escaping).<br>
<br>
but the ExternalProject_expat.mk doesn't set *FLAGS variables - so the <br>
ones from <a href="http://config_host.mk" rel="noreferrer" target="_blank">config_host.mk</a> should be in effect - and the <br>
ExternalProject_liborcus.mk sets them by "liborcus_CXXFLAGS=$(CXXFLAGS) <br>
..." so effectively appending.<br>
<br>
ah, in LinkTarget.mk in the gb_GCOV case no CXXFLAGS are set, only <br>
gb_CXXFLAGS_COMMON etc - that explains the problems you see, these are <br>
only used for gbuild's native LinkTargets.<br>
<br></blockquote><div><br></div><div>Thanks for that bit. The fact that I still find it slightly difficult to follow only underscores my inability to read or modify makefiles (properly).</div><div><br></div><div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
if you want coverage in externals, it might make sense to pass properly <br>
set *FLAGS variables to LO's configure - this will then override <br>
gbuild's optimization and debugging flags, so include "-g" in case it's <br>
needed for the converage (i don't know how that works).<br></blockquote><div><br></div><div>What I got from that, was that I need to do *both* of the following :<br><br>set CFLAGS/CXXFLAGS/LDFLAGS for gcov on the ./autogen commandline :<br>CFLAGS='-fprofile-arcs -ftest-coverage' CXXFLAGS='-fprofile-arcs -ftest-coverage' LDFLAGS='-fprofile-arcs -lgcov' ./autogen.sh <br><br>and set gb_GCOV=YES on the make commandline :<br>gb_GCOV=YES make<br><br>which gives me a successful build (!) (without having to modify any makefiles).<br><br><br>Thanks.<br><br><br>- Maarten</div><div><br></div></div></div>