c++sonarqubevxworkssonarscannerwind-river-workbench

How To Configure SonarQube Dev Edition For a C++ RTP Application Project


I am developing a couple or C++ Real-Time Process Application projects for VxWorks 6.9 in Wind River Workbench 3.3. I wanted to integrate SonarQube developer edition to get static analysis results.

VxWorks compiles the app using the Wind River GCC 4.3.3 compiler, which is a custom flavor of GCC for VxWorks. I have the build-wrapper, sonar-scanner, and the sonar server configured. I can see the project appear in SonarQube after successful execution of sonar-scanner.

The thing that I am having an issue with is that when I have, say a simple C++ file like the following:

I have tried compiling the build-wrapper example SonarQube provides with the VxWorks compiler just using

c++pentium -o main.o main.cpp

and the SonarQube instance shows the bugs.

I have also created a new base RTP application project and included the main.cpp file from SonarQube and for some reason, when I don't have any C++ standard library headers, I get bugs, but when I #include something like I get zero bugs. It seems like the build-wrapper or sonar-scanner cannot find anything C++ related or fails to find the bugs when anything C++ related is included.

main.cpp

#include <iostream>

int main()
{
    int arr[2];

    for (int i = 0; i < 3; ++i) {
        arr[i] = 0;
    }

    return 0;
}

Workbench build command

build-wrapper-win-x86-64 --out-dir bw_output %makeprefix% make --no-print-directory

sonar-project.properties

sonar.projectKey=myFirstSonarQubeProject
sonar.projectName=My First C++ SonarQube Project
sonar.projectVersion=1.0
sonar.sources=.
sonar.cfamily.build-wrapper-output=COREgnu_LP64_RTP/bw_output
sonar.sourceEncoding=UTF-8

Solution

  • The newest version of SonarCFamily, 6.2, adds support for the Wind River VxWorks GCC -mrtp flag to build and analyze RTP applications.