Does SonarCFamily support DDC-I's GCC compiler?

sonarcfamily

(Daniel Bernard) #1

Must-share information:

  • Versions:
    • SonarQube v 6.7.5 (build 38563)
    • SonarScanner v 3.3.0.1492
    • CFamily Build Wrapper v 5.1
    • powerpc-motorola-elf-gcc (DDCI PowerPC ELF 4.6.1-1) 4.6.1
    • powerpc-motorola-elf-ld GNU ld (DDCI PowerPC ELF 4.6.1-1) 2.21
  • Goal:
    • Trying to show structural coverage and run rules against C/C++ code which is compiled for PPC using DDC-I’s GCC-based compiler
  • Issue:
    • Only able to see Duplication Code Smells, no results for Bugs or Vulnerabilities.
  • Details:
    • The .scannerwork/cfamily directory that’s created is empty.
    • The build-wrapper-dump.json contains various lines like so:
{
"version":0,
"captures":[
{
"compiler":"clang",
"executable":"C:\\<redacted>\\GCC\\gcc-4.6.1\\bin\\powerpc-motorola-elf-gcc.exe",
"stdout":"<redacted>",
"stderr":"<redacted>"},
{
"compiler":"clang",
"executable":"C:\\<redacted>\\GCC\\gcc-4.6.1\\bin\\powerpc-motorola-elf-gcc.exe",
"cmd": [
"PATH=<redacted>;C:\\<redacted>\\GCC\\gcc-4.6.1\\bin\\",
"SYSTEMDRIVE=C:",
"SYSTEMROOT=C:\\windows",
"WINDIR=C:\\windows"]}
]
}

Steps taken:

  1. Build code using
    build-wrapper-win-x86-64.exe --out-dir bw-outputs make very_clean all
  2. Run SonarScanner using
    sonar-scanner.bat

Noting that the log from sonar-scanner.bat indicates:

INFO: 0 compilation units analyzed
INFO: PCH: 0 + 0 + 0 , 0 - 0 - 0 - 0
INFO: FS: 0 lookups
INFO: PPH: 0 files, 0 bytes, 0 hits, 0 queries
INFO: Sensor CFamily [cpp] (done) | time=4921ms

I would assume that since it’s a GCC-based the compiler would be listed as gcc instead of clang.
To my knowledge, the only difference between DDC-I’s GCC and the standard GCC is that dynamic memory creation (malloc/free) is removed (it’s used to develop safety-critical software for aerospace applications), and possibly some other small tweaks. I would expect it to be similar to WindRiver’s GCC.
If this compiler is not supported, is there some way for me to make CFamily treat it like it’s GCC?


(Daniel Bernard) #2

Ah, when I was searching earlier I somehow missed this topic.
I’ll see what I can do to compile it with gcc.


(Massimo Paladin) #3

Hi @daniel.bernard_hw,

we don’t officially support DDCI gcc compiler, however as it is a gcc derived compiler it should work. Could you please share the entire build-wrapper-dump.json privately with me so I can give a look at it?


(Daniel Bernard) #4

Certainly - Though admittedly I can’t seem to find where to send you a private message.
Is that something only staff can initiate?


(Daniel Bernard) #5

Logs sent via direct message.


(Massimo Paladin) #6

For the records, you were affected by CygWin environment, precisely by what described in CPP-1249.

The fix is to add the following environment variable before invoking build-wrapper:

export CYGWIN=wincmdln


(Daniel Bernard) #7

Just a reminder if I or anyone else trying to use DDC-I’s GCC-based compilers for Deos ever come across my own post again, I added into our existing Cygwin flags by running:export CYGWIN="${CYGWIN} windcmdln"

Huge thanks to @mpaladin for their fast support on this.