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

Maarten Hoes hoes.maarten at gmail.com
Wed May 11 14:53:38 UTC 2022


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.



Sincerely,


Maarten.




--------------

[CXX] workdir/UnpackedTarball/libcmis/src/libcmis/base-session.cxx
[CXX] workdir/UnpackedTarball/libcmis/src/libcmis/document.cxx
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(png.o):
in function `_sub_I_00100_0':
png.c:(.text+0x9d74): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(png.o):
in function `_sub_D_00100_1':
png.c:(.text+0x9d7f): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(png.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngerror.o):
in function `_sub_I_00100_0':
pngerror.c:(.text+0x1e9d): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngerror.o):
in function `_sub_D_00100_1':
pngerror.c:(.text+0x1ea8): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngerror.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngget.o):
in function `_sub_I_00100_0':
pngget.c:(.text+0x31ce): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngget.o):
in function `_sub_D_00100_1':
pngget.c:(.text+0x31d9): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngget.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngmem.o):
in function `_sub_I_00100_0':
pngmem.c:(.text+0x8e5): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngmem.o):
in function `_sub_D_00100_1':
pngmem.c:(.text+0x8f0): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngmem.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngpread.o):
in function `_sub_I_00100_0':
pngpread.c:(.text+0x3e35): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngpread.o):
in function `_sub_D_00100_1':
pngpread.c:(.text+0x3e40): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngpread.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngread.o):
in function `_sub_I_00100_0':
pngread.c:(.text+0xa9bc): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngread.o):
in function `_sub_D_00100_1':
pngread.c:(.text+0xa9c7): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngread.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrio.o):
in function `_sub_I_00100_0':
pngrio.c:(.text+0x248): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrio.o):
in function `_sub_D_00100_1':
pngrio.c:(.text+0x253): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrio.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrtran.o):
in function `_sub_I_00100_0':
pngrtran.c:(.text+0xe5d9): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrtran.o):
in function `_sub_D_00100_1':
pngrtran.c:(.text+0xe5e4): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrtran.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrutil.o):
in function `_sub_I_00100_0':
pngrutil.c:(.text+0xbf6b): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrutil.o):
in function `_sub_D_00100_1':
pngrutil.c:(.text+0xbf76): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngrutil.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngset.o):
in function `_sub_I_00100_0':
pngset.c:(.text+0x4b40): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngset.o):
in function `_sub_D_00100_1':
pngset.c:(.text+0x4b4b): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngset.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngtrans.o):
in function `_sub_I_00100_0':
pngtrans.c:(.text+0x16d3): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngtrans.o):
in function `_sub_D_00100_1':
pngtrans.c:(.text+0x16de): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngtrans.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwio.o):
in function `_sub_I_00100_0':
pngwio.c:(.text+0x34a): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwio.o):
in function `_sub_D_00100_1':
pngwio.c:(.text+0x355): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwio.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwrite.o):
in function `_sub_I_00100_0':
pngwrite.c:(.text+0x5cbd): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwrite.o):
in function `_sub_D_00100_1':
pngwrite.c:(.text+0x5cc8): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwrite.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwtran.o):
in function `_sub_I_00100_0':
pngwtran.c:(.text+0x1557): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwtran.o):
in function `_sub_D_00100_1':
pngwtran.c:(.text+0x1562): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwtran.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwutil.o):
in function `_sub_I_00100_0':
pngwutil.c:(.text+0x7235): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwutil.o):
in function `_sub_D_00100_1':
pngwutil.c:(.text+0x7240): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(pngwutil.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(intel_init.o):
in function `_sub_I_00100_0':
intel_init.c:(.text+0xcd): undefined reference to `__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(intel_init.o):
in function `_sub_D_00100_1':
intel_init.c:(.text+0xd8): undefined reference to `__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(intel_init.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(filter_sse2_intrinsics.o):
in function `_sub_I_00100_0':
filter_sse2_intrinsics.c:(.text+0x1d9a): undefined reference to
`__gcov_init'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(filter_sse2_intrinsics.o):
in function `_sub_D_00100_1':
filter_sse2_intrinsics.c:(.text+0x1da5): undefined reference to
`__gcov_exit'
/usr/bin/ld:
/home/maarten/src/libreoffice/core/workdir/LinkTarget/StaticLibrary/liblibpng.a(filter_sse2_intrinsics.o):(.data.rel+0x20):
undefined reference to `__gcov_merge_add'
[CXX] workdir/UnpackedTarball/libcmis/src/libcmis/folder.cxx
clang-14: error: linker command failed with exit code 1 (use -v to see
invocation)
make[1]: ***
[/home/maarten/src/libreoffice/core/external/skia/Library_skia.mk:10:
/home/maarten/src/libreoffice/core/instdir/program/libskialo.so] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:288: build] Error 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20220511/601c8a9c/attachment.htm>


More information about the LibreOffice mailing list