Error during SonarScanner execution on C project: java.lang.IllegalStateException

  • SonarScanner 5.0.1.3006

Hello,

I’m trying to configure my C project on Github to launch a scan on my project everytime I pull modifications on the main Branch.

For that I created sonar-project.properties file in the root of my project and an action.yaml file in the .github\workflows direcotry of my project.
To compile my project, we use Keil IDE µvision v5.33.
So to created a json file with build-wrapper-win-x86-64.exe, I used the following command line in a Windows PowerShell:
.\build-wrapper-win-x86-64.exe --out-dir wrapper-out C:\Keil_v5\UV4\UV4.exe -b .\SCP-SW-08-Application_Sources\SCP_APP\SCP_APP.uvprojx

I put the build-wrapper-dump.json and build-wrapper files in .\wrapper-out directory
I added the path in my sonar-project.properties.

My project tree:
Link

When I did a pull request, the Scan is launched, but I’ve the following error: java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /github/workspace/wrapper-output/build-wrapper-dump.json

I searched on the forum, it seems the json file directory is wrong in my sonar-project.properties file.

But when I look the SonarQube Scan log file, it seems to find it.

Do you have an idea where does come from my problem?

Thanks for your support.

My SonarQube log:
Link

My YAML file:
Link

My sonar-project.properties file:
Link

Hey there.

You need to make sure that the build-wrapper and build is happening in the same context as the analysis. You can’t copy a build wrapper dump from a local machine and expect it to work in the GitHub build environment.

Take a look at the example here: GitHub - sonarsource-cfamily-examples/windows-cmake-gh-actions-sq: An example C++ repository built with CMake on Windows using GitHub Actions and analyzed on SonarQube

Thank you for your anwser.
For my comprehension, is the Keil compiler and the build-wrapper need to be installed on the server ?
This point is not clear for me.
Thanks.

Yes, you will need to be able to compile your code in GitHub actions, which means having the relevant compiler available.

It seems I unlucky, the Keil µvision compiler seems not supported by SonarQube.
(C/C++/Objective-C)
Is a solution exist for the unsupported compilers ?
Is not possible to force SonarQube to use directly my json and log file directly stored in my Github project without to launch a new compilation and wrapper command?
Thanks.

You need a fresh compilation, and a supported compiler.

You can track support for Keil compilers at Issue navigator - Jira.

There is no workaround, unless it’s possible to compile with another (supported) compiler just for analysis purposes.