Compiling LO for lcov/gcov code coverage fails (gb_GCOV=YES)

Luboš Luňák l.lunak at collabora.com
Wed May 11 17:28:33 UTC 2022


On Wednesday 11 of May 2022, Maarten Hoes wrote:
> Hi,
>
>
> I'm trying to build LibreOffice on Linux (Fedora 36) with the appropriate
> flags set for 'lcov/gcov code coverage' (how many / which lines of the
> codebase get executed by running the test suite 'make check'). Normally you
> would set the appropriate CFLAGS / LDFLAGS (-fprofile-arcs -ftest-coverage)
> to make this work. But if I recall correctly, due to the way the build
> system works, you have to set a certain env var (gb_GCOV=YES make) on the
> commandline in order to get the appropriate flags set. The magic seems to
> be happening in lines 112-117 in 'solenv/gbuild/platform/com_GCC_defs.mk'.
> This used to work (I wrote a shell script that automated the process back
> in 2015 or so).
>
> However, at the moment I'm getting build errors (undefined reference to
> '__gcov_init' / '__gcov_exit') that imply the flags are not being set
> (error details at bottom). So I'm guessing that either the way you are
> supposed to do this changed, or something broke the propagation of the
> flags or something ? I ran autogen the following way :
>
> ./autogen.sh --enable-python=internal --without-system-libs
> --without-system-headers
>
> I personally do not know enough about the build system to figure out how to
> correct this. Any and all help in trying to make this work again would be
> appreciated.

 You can pass verbose=t to make to see all the commands that are run when 
building. And you can do things like 'make -C external Module_skia' to limit 
what make runs. That way you can verify if the flags are used.

 If the flags really are not used, then grep the relevant makefiles for 
ldflags (including solenv/gbuild), and try editing them to see where it needs 
to be added.

-- 
 Luboš Luňák
 l.lunak at collabora.com


More information about the LibreOffice mailing list