Issues with TI armcl compiler and sonar scanner

SonarQube Version: Data Center Edition Version 9.9 (build 65466)
Sonar Scanner Version:
TI Compiler Version: TI ARM C/C++ Compiler v20.2.7.LTS
OS: Debian based Linux x64

I have a CMake build project, and I use the build wrapper to generate the dump of the compile commands. After which I try to use sonar scanner and get the error that JSON file was found, but 0 files were analyzed. I followed this post: Texas instruments compilers. ARMCL compiler support - #9 by Tomasz_Kaminski to make the necessary changes so the build wrapper would work. Any help would be appreciated.

Hi @rahul-arasikere ,

if you are using CMake there is no need to use that trick to capture the compiler calls with build-wrapper. You can directly use the compilation database to configure the analysis. You just need to set CMAKE_EXPORT_COMPILE_COMMANDS=ON (CMAKE_EXPORT_COMPILE_COMMANDS — CMake 3.28.0-rc5 Documentation). You can just add set(CMAKE_EXPORT_COMPILE_COMMANDS ON) to your CMakeLists.txt and it will generate compile_commands.json file in your build directory.

You then need to set sonar.cfamily.compile-commands=path/to/build/compile_commands.json in your sonar analysis.

You can follow the documentation: C/C++/Objective-C

So I am now using the compile_commands.json file that is generated by the cmake project. I am also running the sonar scanner on x64 Windows 11 OS. I still see the same issue where no files were analyzed but the compilation database was found.

This being the exact error:

ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: The Compilation Database JSON file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:
  * you are correctly invoking the scanner with correct configuration
  * your compiler is supported
  * you are providing the path to the correct Compilation Database JSON
  * you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps
        at com.sonar.cpp.plugin.CFamilySensor.process(
        at com.sonar.cpp.plugin.CFamilySensor.execute(
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
        at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(
        at org.sonar.core.platform.SpringComponentContainer.startComponents(
        at org.sonar.core.platform.SpringComponentContainer.execute(
        at org.sonar.scanner.scan.SpringProjectScanContainer.scan(
        at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(
        at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(
        at org.sonar.core.platform.SpringComponentContainer.startComponents(
        at org.sonar.core.platform.SpringComponentContainer.execute(
        at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(
        at org.sonar.core.platform.SpringComponentContainer.startComponents(
        at org.sonar.core.platform.SpringComponentContainer.execute(
        at org.sonar.batch.bootstrapper.Batch.doExecute(
        at org.sonar.batch.bootstrapper.Batch.execute(
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.main(

Hi @rahul-arasikere ,

if you are still facing an issue there could be two cases:

  • you have a misconfiguration in your analysis properties
  • you are using an unsupported compiler or compiler property

In both cases, I need the log output of the sonar-scanner in verbose mode and the compilation database. Would you be able to share them if I send you a private message?

Yes I would be able to share them if you sent me a private message.

I sent you a private message.

Hi @rahul-arasikere ,

you are facing [CPP-4088] - Jira. While waiting for a fix you can follow one of the workaround described in the ticket.

That worked I used sed -i 's/--c_file=//g' compile_commands.json.


@rahul-arasikere thank you for the confirmation.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.