Closed Shyamlalkumawat closed 1 year ago
I do not have ready access to gcc/9.4 - so can't reproduce your experiment - however, gcov appears to be complaining that the data format is from gcc/4.X - not 9.X
What toolchain version did you use to compile and link your code? Platform probably doesn't matter...but what platform and version?
You could also try using gcov from a 4.8.X gcc toolchain.
It also appears that you truncated your output a bit - as there ought to be a bit more information in the error logs.
I am having ubantu Linux system . And I have Android binary . And using this script https://gist.github.com/pankajgangwar/f070b8b54e83543f8e3638dcd2cae1b8
I am able to create .gcda and .gcno file . I have install gcc version - 9.4 which is latest. And same gcov version.
I am not able to install gcov 4.6 or 4.x as its deprecated and not available on ubantu repo.
Note- In the script gcc4.2 mentioned please consider gcc 9.4 or upper version. Should I install lower gcc version to wrok with it ?
Or something else issue If it is issue with data format of 9.X the. How to make compatible with 4.x pls guide
when we look at that script we discover:
llvm
and llvm-cov
If you really want to use gcc/9.4, I suggest a simple experiment to start you out:
gcc --coverage ....
lcov --capture ...
and see if you get compatabilty messages or valid data.If the simple experiment works as expected and your android application does not...then we have quite a bit of confidence that your data was not generated with gcc/9.4.
If you do want to use llvm, then you could use llvm-profdata
and llvm-cov export -format=lcov ....
to produce your LCOV-format data - and bypass gcc entirely.
Note that 'llvm-cov export ...' does not appear to support branch coverage (which is strange, as the profiles obviously contain the information); this is one reason why you might prefer the gcc approach.
The other thing I forgot to mention is that you can also simply use llvm-cov gcov ...
to read the llvm-generated gcda/gcno files. llvm produced the data, and llvm is likely to be happy to read it.
To to that:
lcov --capture -o cov.info --gcov-tool llvm-cov --gcov-tool gcov -d myDir ...
(please see the lcov and/or geninfo man page for a more detailed description.
No followup - so I guess that this issue is addressed/you found matching tool versions and the error messages went away. If so: please go ahead and close this issue. If not: please describe the problems you see. Thanks Henry
We are able to run the experiment but android binaray still having same error /home/android/code/manifest/out/coverage/USER/CPUDataProcessor.gcda:version '402', prefer version 'A94'
We have tried the llvm cov also but here some gcda file are not found.
lcov --directory . --gcov-tool /home/android/code/manifest/prebuilts/clang/host/linux-x86/llvm-binutils-stable/llvm-cov --capture -o covin.info --no-external Capturing coverage data from . Found LLVM gcov version 11.0.1, which emulates gcov version 4.2.0 Usage: llvm-cov {export|gcov|report|show} [OPTION]...
Shows code coverage information.
Subcommands: export: Export instrprof file to structured format. gcov: Work with the gcov format. report: Summarize instrprof style coverage information. show: Annotate source files using instrprof style coverage. Scanning . for .gcda files ... Found 20 data files in . Processing CPUDataProcessor.gcda geninfo: ERROR: /home/android/code/manifest/out/coverage/User/CPUDataProcessor.gcno: could not open file
Note that there are TWO uses of the --gcov-tool
option in the command line I showed above.
You appear to have used one - and also appear to have not read the man page for this and other options.
In case it was not obvious from above: you need to change your command line to
lcov --directory . --gcov-tool /home/android/code/manifest/prebuilts/clang/host/linux-x86/llvm-binutils-stable/llvm-cov --gcov-tool gcov --capture -o covin.info --no-external
Basically: tell lcov that your command is llvm-cov gcov myfile.gcda ....
In the man pages, this is referred to as '-Xlinker' flag behaviour - as gcc uses exactly this same idiom.
Any update on this issue? My strong suspicion is that it is resolved and this issue can be closed.
Other LLVM users might also find useful suggestions in #234.
As discussed above: I believe that this issue is resolved - and so will close it now. If there is still a problem: please either reopen this issue or file a new one. Include a detailed description of the problem, and ideally a testcase which illustrates the issue. Henry
While running the script with Gcov and lcov it is giving error for version '402', prefer 'A94' I have installed Gcov 9.4.0 and same gcc also
`` lcov --directory . --base-directory . --gcov-tool /usr/bin/gcov --capture -o cov.info Capturing coverage data from . Found gcov version: 9.4.0 Using intermediate gcov format Scanning . for .gcda files ... Found 1 data files in . Processing test1.gcda /home/android/Downloads/User/Test/test1.gcno:version '402', prefer 'A94' geninfo: ERROR: GCOV failed for /home/android/Downloads/Geeta/Test/test1.gcda!
I tried with --gcov-tool /usr/bin/gcov-9.4.0 also but same error. ``
Cov.info is also not generating