Trouble getting sonarqube to scan c++ files

SonarQube Version: 7.9.1
Scanner Version: 4.5.0.2216

We are trying to get sonarqube to analyze our c++ project. We have several subdirectories in which all the files that need to be included in our coverage scan. When the project is built it is dynamically linked. We have successfully been able to compile the files and produce .gcno,.gcda and .gcov files for each of the source files. We collect all the gcovs into one directory that acts as our report directory for them to be analyzed from. However when sonar scanner goes to scans the files in the directory we have the following message:
“WARN: File not analyzed by Sonar, so ignoring coverage: <file_path>”

We have tried fiddeling with the -Dsonar.cfamily.gcov.reportsPath with no success. We are not sure what to do next to make is so it actually analyzes the gcovs.

Hi @msilveus ,

the reason might be the relative paths in the reports. I invite you to have a look at this other post: Unable to setup build-wrapper + sonar-scanner with GitHub Actions - #5 by mpaladin which may help.

Hi @mpaladin
Thank you for responding so quickly. I have tried the changes that you suggested but I continue to have the same error persist which I mentioned before. I forgot to mention in the original post that we run our tests in two phases. They have separate executables in which each set of the unit tests are run. Both the first and second phase does not get analyzed via the gcov report directory. However separately after this point the logs detail that sonar scanner is using the build-wrapper-dump.json and proceed to analyze the first 16 files in this log. These files are the source files that are tested by the second phase of unit testing.

Hi @msilveus ,

your setup is not that clear, would you like to share the file tree, the sonar-scanner invocation properties, and the output log?

@mpaladin
Unfortunately due to the proprietary nature of some of our work I can not provide all that you have requested. I will however provide sanitized snippets from the sonar scanner output logs , sanitized versions of our file tree and sonar-project.properties, and a sanitized version of the Jenkins commands that we use to execute sonarqube’s scanner.
Sanitized Sonar Project Properties:


Sanitized Sonar-scanner output logs

Sanitized File Tree and Jenkins Commands

Hopefully this helps. Sorry for the inconvenience.

Hi @msilveus ,

it is not that easy to help you by just looking at some screenshots. If you are still facing issues and can provide the full logs in private I can send you a private message.