Search code examples
pythoncgccpython-c-apigcov

GCOV Version mismatch - expected 700e got 408R


On one server with GCC 4.4.7/GCOV 4.4.7, I'm able to run the tests successfully. However on a different server with GCC 4.8.5/GCOV 4.8.5, running the tests results in this error:

profiling:/path/to/foo.gcda:Version mismatch - expected 700e got 408R

Here are the output of the versions:

$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)

$ gcov --version
gcov (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)

After searching for this error, it seems that it is often caused by mismatched versions between gcc and gcov, however mine have the same versions.

We recently upgraded gcc on this server from 4.4.7 to 4.8.5. This issue seems to be caused by the upgrade.

I should mention that I'm testing a Python C Extension, which I think is a bit different from testing a normal C application.

I do the following:

export CFLAGS="--coverage"
python setup.py build_ext --inplace
python tests.py

On both servers, that second command creates the .gcno files appropriately.

On the server with 4.4.7, the third command will successfuly create the .gcda files. But the server with 4.8.5 prints that error message


Solution

  • The coverage instrumentation produced by one version of GCC is not wholly compatible with that produced by others, so GCC versions it. The error message reported seems to indicate that you are performing coverage analysis with one version of the toolchain against artifacts and instrumentation that were at least partially built with a different version.

    To resolve the issue, you should ensure that all the instrumented binaries, including any libraries, and any other coverage related built artifacts were all produced via the same version of the toolchain. A completely clean rebuild from the sources of the components under test -- including any instrumented libraries, whether part of the same build or not -- should do the trick. It is probably unnecessary to rebuild binaries that have not been instrumented for coverage testing, however.