6

I am trying to determine my testcoverage. To do this I compile my program with a newer version of gcc:

CC=/usr/local/gcc8/bin/gcc  FC=/usr/local/gcc8/bin/gfortran ./configure.sh  -external cmake -d

After compiling this with the --coverage option I run my tests and this creates *.gcda, *.gcno and *.o.provides.build files. And if I run something like:

> $ /usr/local/gcc8/bin/gcov slab_dim.f90.gcda                                                                             [±develop ●]
File '/Local/tmp/fleur/cdn/slab_dim.f90'
Lines executed:0.00% of 17
Creating 'slab_dim.f90.gcov'

Which shows me, that gcov runs fine. However if I try to run lcov on these results:

lcov -t "result" -o ex_test.info -c -d CMakeFiles/

I get error messages like these for every file:

Processing fleur.dir/hybrid/gen_wavf.F90.gcda
/Local/tmp/fleur/build.debug/CMakeFiles/fleur.dir/hybrid/gen_wavf.F90.gcno:version 'A82*', prefer '408R'
/Local/tmp/fleur/build.debug/CMakeFiles/fleur.dir/hybrid/gen_wavf.F90.gcno:no functions found
geninfo: WARNING: gcov did not create any files for /Local/tmp/fleur/build.debug/CMakeFiles/fleur.dir/hybrid/gen_wavf.F90.gcda!

This is the same error message I get when I use the systems standard /usr/bin/gcov

This leads me to believe that lcov calls the old gcov rather than the new one. How do I force gcov to use the new version?

Stein
  • 3,179
  • 5
  • 27
  • 51

3 Answers3

1

The simplest solution I found was to run /usr/bin/gcov-8 instead of /usr/bin/gcov.

Eric Duminil
  • 52,989
  • 9
  • 71
  • 124
0

The $PATH environment variable needs to be to extended by /usr/local/gcc8/bin/

Stein
  • 3,179
  • 5
  • 27
  • 51
0

The source of the error is clear, from the fact that you get the same result by using /usr/bin/gcov. /usr/bin/gcov should be a link to a binary from the installed compiler, but in your case the link doesn't point to a binary within gcc 8.2 installation.

You can delete the link and re-create it to point to the correct gcov or you can setup something like update-alternatives to change the version of gcov when you change the default compiler.

The previous answer should work as well if you have a binary called gcov in /usr/local/gcc8/bin, because if you add that path, into your environment PATH first, it will be selected first.

Cristian Bidea
  • 679
  • 4
  • 12