'make check' fails when building with gcov code coverage

Miklos Vajna vmiklos at collabora.com
Tue May 31 06:52:39 UTC 2022

Hi Maarten,

On Fri, May 27, 2022 at 10:26:21AM +0200, Maarten Hoes <hoes.maarten at gmail.com> wrote:
> CFLAGS='-fprofile-arcs -ftest-coverage' CXXFLAGS='-fprofile-arcs
> -ftest-coverage' LDFLAGS='-fprofile-arcs -lgcov' ./autogen.sh
> --enable-python=internal --without-system-libs --without-system-headers
> gb_GCOV=YES verbose=t make --output-sync=target
> gb_GCOV=YES verbose=t make check -k --output-sync=target

I believe that manually specifying CFLAGS/CXXFLAGS/LDFLAGS is not
necessary for coverage, and if you run into problems, we should rather
fix that.

> I recently started a thread [1] that is about the (complete, not partial)
> build with gcov failing for me if I only set 'gb_GCOV=YES' on the make
> commandline. The build succeeds for me if I also set the required *FLAGS on
> the autogen commandline. The failing parts when only using 'gb_GCOV=YES'
> were/are 'liborcus' and 'expat'.

I wonder if then our makefiles for liborcus / expat should be fixed to
take flags set by gb_GCOV at solenv/gbuild/platform/com_GCC_defs.mk:117
into account?

> Skia (I think) initially also broke the
> build, but that was because of conflicts between clang and gcc [2], which
> was resolved when I uninstalled clang. If I understand correctly, it was
> intended to force skia to always be built with clang, but - intended or not
> - at least on Linux it falls back on gcc (or skia gets skipped perhaps).

Building skia with clang is about helping performance, so you're fine to
fall back to gcc, probably. Disabling skia completely would mean you
don't get coverage for the code that integrates skia with the rest of
LO, which is probably not great.

> When looking at 'coverage.sh', it seems it only covers specific parts of
> the build, and not everything, so perhaps it doesn't build the parts that
> fail for me when not setting the additional *FLAGS ?

Yes, coverage.sh is only a partial rebuild, with the idea that if you
work on an area anyway, then you may want to improve coverage where you
have domain knowledge. Which has some overlap with your "get a global
picture" goal, but somewhat different. :-)

> Anyway, if you feel that setting the additional *FLAGS in addition to
> 'gb_GCOV=YES' is not the right way to address the problem of the full build
> with gcov failing for me, then perhaps we should revisit that thread [1],
> before we continue looking at why 'make check' fails for me ?

My suggestion would be to just keep the above in mind. Obviously there
is value in getting a full make check working with coverage *somehow*,
so if you have a preference how you do that, feel free to go ahead that
way. It just seemed weird that those global compiler/linker flags are
set in your build: gb_GCOV is ideally enough to set all of these.



More information about the LibreOffice mailing list