SonarQube Build-Wrapper for c/c++ with Scons.bat build wrapper

Condition to consider :

  1. Use Scons.bat python wrapper pass the scons.bat to to build-wrapper for c/c++ embedded program analysis as a build file.

  2. While every build deletes all old directories/folders used for build and checkouts the code and executes the build through scons.bat - simulating the clean option similar to make clean all but by programmatically deleting the folder and creating fresh with source code and other files for build requirement.

  3. 8.9 version of Sonarqube is used and the build-wrapper was download from the document linked to this version path.

  4. With this approach the build takes a long time more than 9 minutes, while without build-wrapper but with just scons.bat it just takes 12 minutes to build an embedded c/c++ code.

Questions to understand-

  1. Is there a need to do a clean build if the build is attempted with a new folder/path/ fresh path.

  2. build-wrapper.log and the build-wrapper-dump.json files are created but with 0 byte -empty.

  3. Why is sonar-build-wrapper taking 70+ minutes more for the same code when it is involved, How do i reduce it.

SonarQube Version 8.9 no additional plugins related to build requirement.

Hey there.

What is the actual compiler that scons.bat is calling?

Scons calls C

The time it takes after upgrade to latest LTS is addional hour - 8.9.10
I guess this is a common issue for c/c++ IAR compiler

Looks with Scons wrapper SonarQube has underperformance with IAR build and also the json file does not contain much of information.

It looks like something has changed, if the build wrapper file is now containing information.

What changed?

hi, could not revert earlier due to long break.

buildwrapper.json and buildwrapper log are created with around approx 0.5 million lines in each logs approx 30MB size of json and log file,

I also noticed that during the build process the CPU loads fully both with and without BuildWrapper only difference is that with build-wrapper the time that it takes is almost 300% more than the direct scons build on a 4 core CPU with 16GB memory. Increasing cores to 16 did result with a faster build. I do not understand why this is happening with the Build-wrapper. Any way to know more on this. But for sure, without much of document help on sonarqube for build-wrapper with scons this will be a challenge always.
Is there any configuration to be checked on SonarQube Server (i do not think this is a case as he build wrapper may not even interact with the server till it gets its json/lobs created and an scanner is called for execution) Please od let me know if you wnat me to test this with any additional configuration.

Hey there.

Thanks for the further details. You’re right that there should be no configuration to check on the SonarQube server’s side.

So far, we have never seen any noticeable performance degradation due to build-wrapper, as it is a very thin layer around the usual compiler.

Our recommend troubleshooting includes the following:|

  • Running your tests with anti-virus switched off (which can impact the performance of the build wrapper) - Making sure you’re running your build command from the exact same folder
  • Making sure that java and build-wrapper are on the same disk and not, for example, on a network drive