Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lcov incompatible with GCC 9.x coverage data #58

Closed
berrange opened this issue Jan 24, 2019 · 17 comments
Closed

lcov incompatible with GCC 9.x coverage data #58

berrange opened this issue Jan 24, 2019 · 17 comments

Comments

@berrange
Copy link
Contributor

berrange commented Jan 24, 2019

Fedora 30 rawhide has pulled in the last GCC 9.0.0 version and this appears incompatible with lcov

$ echo "const int a = 5; int main(void) { return 1;}" > t.c
$ gcc -Wall -Wextra -Werror ./t.c --coverage
$ ./a.out 

Previously with GCC 8 compiled binaries this would work:

$ lcov -t "result" -o ex_test.info -c -d .
Capturing coverage data from .
Found gcov version: 8.2.1
Scanning . for .gcda files ...
Found 1 data files in .
Processing t.gcda
Finished .info-file creation
$ lcov -l ex_test.info
Reading tracefile ex_test.info
            |Lines       |Functions  |Branches    
Filename    |Rate     Num|Rate    Num|Rate     Num
==================================================
[/home/berrange/src/virt/libvirt-go/]
t.c         | 100%      1| 100%     1|    -      0
==================================================
      Total:| 100%      1| 100%     1|    -      0

With GCC 9 compiled binaries it fails

$ ./lcov/bin/lcov -t "result" -o ex_test.info -c -d .
Capturing coverage data from .
Found gcov version: 9.0.0
Scanning . for .gcda files ...
Found 1 data files in .
Processing t.gcda
geninfo: WARNING: /home/berrange/t.gcno: Overlong record at end of file!
geninfo: WARNING: gcov did not create any files for /home/berrange/t.gcda!
Finished .info-file creation

There are some GCC changes that affected coverage data format:

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=261189
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=264462

The info above is all taken from a Fedora bug report https://bugzilla.redhat.com/show_bug.cgi?id=1668843

@robinmoussu
Copy link

In case it may help, on my pet project I can use gcov to get the code coverage, but lcov fails. A really recent g++9 build is required, some stuff were fixed in gcov less than a week go and it uses C++20 feature only available on g++ at the moment.

if you have meson + conan + lcov + genhtml installed, and an extremely fresh build of g++9, it should be as easy to test as

git clone https://gitlab.com/robinmoussu/rollordie3.git && cd rollordie3
make
make coverage

I didn't tested to install it from another computer than mine however.

Feel free to ask me any additional data.

@oberpar
Copy link
Contributor

oberpar commented Mar 1, 2019

I can confirm that the problem exists with LCOV and GCC 9.0 .gcno files. This will be addressed via the LCOV intermediate file format support that I'm working on.

@marxin
Copy link

marxin commented Mar 8, 2019

I can confirm that the problem exists with LCOV and GCC 9.0 .gcno files. This will be addressed via the LCOV intermediate file format support that I'm working on.

Great, may I ignore this as the intermediate support in LCOV will appear before GCC 9.1 is released (May 2019) ?

@oberpar
Copy link
Contributor

oberpar commented Mar 8, 2019

LCOV support for the intermediate file format will (hopefully) be available before May.

@oxr463
Copy link

oxr463 commented May 9, 2019

In my tests, I can confirm this issue affects the following versions:

Tested on official docker images, (See: https://hub.docker.com/_/gcc), for each version, respectfully.

@oberpar are there any issues blocking this that require assistance?

oxr463 added a commit to proot-me/proot that referenced this issue May 9, 2019
Bug: #157

Downgrade gcc image for GitLab CI/CD

Lcov is not compatible with the latest
gcov output; downgrading gcc version
to use an older gcov until the issue is
resolved.

Bug: linux-test-project/lcov#58
oxr463 added a commit to proot-me/proot that referenced this issue May 9, 2019
Bug: #157

Downgrade gcc image for GitLab CI/CD

Lcov is not compatible with the latest
gcov output; downgrading gcc version
to use an older gcov until the issue is
resolved.

Bug: linux-test-project/lcov#58
oxr463 added a commit to proot-me/proot that referenced this issue May 10, 2019
Bug: #157

Downgrade gcc image for GitLab CI/CD

Lcov is not compatible with the latest
gcov output; downgrading gcc version
to use an older gcov until the issue is
resolved.

Bug: linux-test-project/lcov#58
@oberpar
Copy link
Contributor

oberpar commented May 28, 2019

This should be fixed with commit 75fbae1.

@LesnyRumcajs
Copy link

I can confirm, this is working fine with gcc-9.1.1 minus the extra dependencies I had to install manually.

gnomesysadmins pushed a commit to GNOME/gjs that referenced this issue Jul 26, 2019
GCC 9.x coverage data is incompatible with lcov < 1.14. See for more
info linux-test-project/lcov#58

Fedora has updated lcov to 1.14, and Ubuntu hasn't yet, so run the
coverage-automatic job on Fedora instead. This was otherwise blocking all
pipelines of the master branch.

Unreviewed, pushing to fix build.
@rockdaboot
Copy link

Do you already plan a new release ? Debian (unstable) just switched to gcc 9.2.1 ... :-)

@oberpar
Copy link
Contributor

oberpar commented Aug 20, 2019

Currently no new release is planned. LCOV GCC 9 support for Debian should be covered by a package upgrade to 1.14-2. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=924573

@rockdaboot
Copy link

That bug has been opened in March. I left a comment about gcc 9 on Friday - Saturday they had it fixed :-)

gentoo-repo-qa-bot pushed a commit to gentoo-mirror/gentoo that referenced this issue Aug 21, 2019
This adds upstream patches needed for gcc-9 support to 1.14
since upstream does not plan on making new releases soon[1]
and other distros seem to have included relevant changes in
their 1.14 packages[2][3].

[1] linux-test-project/lcov#58
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=924573#15
[3] https://fedora.pkgs.org/rawhide/fedora-x86_64/lcov-1.14-2.fc31.noarch.rpm.html

Signed-off-by: Nick Herman <gerkola@gmail.com>
@marxin
Copy link

marxin commented Aug 23, 2019

openSUSE Tumbleweed also offers the package that includes the patch:

https://software.opensuse.org/package/lcov?search_term=lcov
lcov-1.15+git.20190524.75fbae1.tar.xz

@bayandin
Copy link

Hello, is there any plans for the next release with gcc-9 support?

edolstra added a commit to edolstra/nixpkgs that referenced this issue Mar 11, 2020
TimGuite added a commit to TimGuite/workflow_challenge that referenced this issue Apr 5, 2020
Coverage is apparently an issue with latest version of GCC - linux-test-project/lcov#58
So not going to worry about that at the moment, although it would be nice to add back in when possible.
@Apteryks
Copy link

Apteryks commented May 9, 2020

Hello, is there any plans for the next release with gcc-9 support?

I too would like to see a new release; at least a tag in here. The only thing missing seems to list the additional new dependencies in the installation section of the README.

jbboehr added a commit to jbboehr/handlebars.c that referenced this issue May 15, 2020
jbboehr added a commit to jbboehr/handlebars.c that referenced this issue May 15, 2020
* Refactor TravisCI configuration to use functions
* Disable coverage on gcc-8 and gcc-9
* Hopefully reduce rebuilds in HerculesCI
* Dump test-suite.log in after_failure for TravisCI

See: linux-test-project/lcov#58
@sarangjo
Copy link

Can this be closed and replaced with a separate request to publish a release? master works well with GCC 9.3.0 per my testing

@lipnitsk
Copy link

@oberpar given how stable this project is (few changes in the last year) and the amount of exposure this issue has received in various distros (I use Arch), isn't it time to tag a new release?

@oberpar
Copy link
Contributor

oberpar commented Aug 4, 2020

I'm currently reviewing the remaining open issues and pull requests for anything that should be included in the next release. Once I'm done with that I plan to release LCOV 1.15 (should be sometime next week).

@oberpar
Copy link
Contributor

oberpar commented Aug 4, 2020

Closing this issue since the original problem has been addressed.

@oberpar oberpar closed this as completed Aug 4, 2020
tvrusso pushed a commit to Xyce/Xyce that referenced this issue Sep 26, 2020
I had the bright idea to see how well my unit tests were covering the
full capabilities of the new expression library.  I figured this would
help as I periodically stumble accross an untested feature by accident,
and there are surely more that I haven't found yet.

gcov only works with gcc, and I had until now mostly used clang.  So, I
had to go back to using gcc, and discovered that my install of gcc was
no longer consistent with my install of Xcode.  So, I had to do a lot of
updates.

I also had to build google tests by hand, because clang-built google
tests will not cross compile with gcc compiled code.   Whatever compiler
is used for the main program has to have been used to build google test.
So, I did that.

I also did numerous builds of trilinos using gcc9.

And finally I created the new makefile: Makefile.gcc9.
I chose to use the most recent gcc I could easily
install.    With this makefile, and also my other gcc9 related changes,
the unit tests astUnitTest and parserUnit test (the main ones I care
about) build just fine on my laptop.  However, a number of them fail
with gcc9 that did not fail with clang.  I think this is probably
because of small comparison failures that will be easily fixed.

I have also created Makefile.gcov_gcc9, which is intended to build the
unit tests with the proper gcov options turned on.  This builds just
fine, and when the code is run it successfully runs astUnitTest and
parserUnitTest, and produces all the additional files one would expect
from gcov.    So, this appears to work.  And, if I run "gcov" directly
on the program(s) I get the expected (in some cases very large) *gcov
files.

However, at this stage I have been unable to get lcov working correctly.
I get a lot of warnings and errors when I run it, and the resulting
*info file (which shoudl be subsequently converted to HTML) is basically
emtpy.  The warnings are often saying something like "really big record
in file xxx"

When I run genhtml on the *info file, I get an error message saying
(paraphrase), "no useful records in *.info file".

I made two very tiny test programs, including the proverbial "hello
world" program, and attempted the same lcov procedure on them.  I got
exactly the same results.   So, the problem is not that my test programs
are somehow too big, which was suggested by some of the warnings.  Even
"hello world" produces a nearly empty *info file.

I did a quick google and found this issue entitled:

"lcov incompatible with GCC 9.x coverage data "
linux-test-project/lcov#58

This webpage describes the behavior I have been experiencing.  This
implies (perhaps) that I should have used gcc8 instead.  So I will try
that next, but I may choose to do some other things first.
Either way, I think these new makefiles will still be useful, if only as
a model for producing gcc8 makefiles.

I should note that I have NOT yet attempted to put the equivalent
makefiles together for the "complex" version of these tests.  I'll do
that later.

--------------------------------------------------------------------------------
Update:

After much experimentation and browsing of the internet, I discovered
that version 1.13 of lcov, which is the version I was using (from
macports) has a bug in it.  That bug prevented it from working with
gcc9.

So, I switched to gcc8, thinking that would fix it.  No dice.

Then I downloaded lcov 1.14-1, the most recent version, and manually
installed it.  That worked just fine with gcc8.  It might also work with
gcc9, but I haven't tried yet.

I also created a little script that performs all the steps of a
gcov/lcov analysis on the program parserUnitTest.  That program is
probably the highest priority unit test program.
facebook-github-bot pushed a commit to pytorch/pytorch that referenced this issue Oct 26, 2020
…46847)

Summary:
According to [this issue](linux-test-project/lcov#58), LCOV 1.14 and below are not compatible with GCC9 when gathering coverage.

Instead of installing `lcov` with `apt-get`, which installs version 1.13, this PR would install v1.15 from source onto the ubuntu Docker images.

Pull Request resolved: #46847

Reviewed By: seemethere

Differential Revision: D24540444

Pulled By: janeyx99

fbshipit-source-id: 0ac2a37241d94cdd8fea2fded7984c495a64cedc
GiovanniBussi added a commit to plumed/plumed2 that referenced this issue Nov 12, 2020
Required two fixes:
- use `mpirun --oversubscribe` (needed by latest openmpi)
- lcov 1.15 (see linux-test-project/lcov#58)
bgeltz added a commit to bgeltz/dotfiles that referenced this issue Nov 30, 2021
- Works around linux-test-project/lcov#58.

Signed-off-by: Brad Geltz <brad.geltz@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests