Compiling LO for lcov/gcov code coverage fails (gb_GCOV=YES)
sbergman at redhat.com
Fri May 13 08:37:19 UTC 2022
On 5/12/22 15:44, Maarten Hoes wrote:
> What I *think* I see happening, is that the '-fprofile-arcs
> -ftest-coverage -lgcov' flags are correctly being set on the
> commandlines, up until were the error occurs, which is where (i think)
> linking against libpng is attempted (see error below). I tried setting
> *FLAGS in 'external/libpng/StaticLibrary_libpng.mk', but that did not
> change things. Am I misunderstanding what is happening here, or perhaps
> modifying the wrong Makefile ? I cannot really tell what is going on
> here, or what to try next.
I guess it just doesn't work well to link an archive like
workdir/LinkTarget/StaticLibrary/liblibpng.a built with GCC and
-fprofile-arcs into a library like Library_skia built with Clang and
-fprofile-arcs: GCC -fprofile-arcs embeds calls to __gcov_init etc.
into the code (satisfied at link time from GCC's libgcov.a) while Clang
-fprofile-arcs embeds calls to llvm_gcov_init etc. into the code
(satisfied at link time from Clang's libclang_rt.profile-*.a). The way
that normally works is that when you use g++ -fprofile-arcs for linking,
it sneaks in a -lgcov towards the end of the command line that it passes
to the linker, and when you use clang++ -fprofile-arcs for linking, it
sneaks in a /path-to/libclang_rt.profile-*.a towards the end of the
command line that it passes to the linker. You have (multiple, even)
explicit -lgocv on your clang++ -fprofile-arcs command line for linking
Library_skia, but that comes too early before the -Wl,--start-group ...
$W/LinkTarget/StaticLibrary/liblibpng.a ... -Wl,--end-group, so can't be
used to satisfy that archive's dependency on __gcov_init etc. (And the
later, sneaked in, /path-to/libclang_rt.profile-*.a doesn't satisfy
those dependencies either, as it rather supplies llvm_gcov_init etc.)
Maybe it would be best if the decision to force using Clang for building
Library_skia would be explicitly opt-in or opt-out.
More information about the LibreOffice