Sonar Scanner failed to analyze source code (ERROR: Exception in thread)

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Enterprise Edition version 9.5 (build 56709)

My environment:
Windows 10 Pro
Sonar Scanner version
CFamily Code Quality and Security (cpp)
Build Wrapper Tool version 6.34
TI_CGT_C6000_7.4.12 compiler - (cl6x)
xdctools_3_24_03_33 build tool - (gmake)

  • what are you trying to achieve
    Build my project using the build wrapper tool and scan with Sonnar Scanner to analyze source code.

  • what have you tried so far to achieve this
    I can build my project with the build wrapper tool fine (no errors) with the following commands

gmake clean
build-wrapper-win-x86-64 --out-dir %BW_OUTPUT% gmake all

However, it fails to analyze source codes with Sonar Scanner.
It spams some errors like this.

ERROR: Exception in thread pool-1-thread-15
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code

It also generated a file that I can share privately.

Welcome to the community @atran!
I have just sent you a PM, where you would be able to share the reproducer.

I have investigated the reproducer and the issue is caused by the fact that we do not see the following macros in the compiler probe, that define the size of given types in bytes:

  • __SIZEOF_INT__

In general, we do not support older versions of Texas Instrument compilers that do not provide these macros. So our recommendation would be to update the newest compiler version (8.x) and retest the analysis.

I have added this information to the CPP-2906 ticket, which is tracking reports and use of older compiler versions.

Consider closing this ticket as it fixed our problem.
We followed your suggestion to add these given types as prefix macros to our .bld file for the TI compiler. The Sonar scanner is working now without errors. I hope SonarQube will add more support for the older TI compilers.

I am glad that the workaround of predefining the above macros in your build solved the problem, it also confirms that this is indeed a viable option.

I cannot promise support for the older TI version though, as:

  • we expect the audience to shrink with time
  • we already have a viable workaround.