'AOSP native code coverage issue, gcno:version '402*', prefer 'a75*' on soong build system

I am working on native code coverage for AOSP11, I am referring following links.

I have generated *.gcno and also genrated *.gcov, but after running

lcov --directory . --base-directory . --gcov-tool /usr/bin/gcov --capture -o cov.info .gcno

to collect the code coverage results, I am getting version mismatch issue, i.e.

gcno:version '402', prefer 'a75'

So I checked, and can see my host machine's gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) and gcov version (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0. And I ran "file *.gcno" (on generated *.gcno intermediates). Its printing GCC--> gcno coverage (-ftest-coverage), version 4.2 So, root cause is quite clear, but how to resolve this for Soong build system?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source