Updated to a new compiler and getting "The "build-wrapper-dump.json" file was found empty."

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • 9.5.0.56709
  • what are you trying to achieve
  • run sonarqube(fails before sonarqube scanner execution)

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hello,

I am using the sonarqube enterprise edition. We recently switched our compiler for the build, from armr5-none-eabi-gcc.exe (GNU Tools for ARM Embedded Processors) 8.2.0 to armr5-xilinx-eabi-gcc.exe (GCC) 11.2.0. Based on the sonarqube documentation, it supports the GCC compiler which is our new compiler. But somehow I get the following issue:

java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found empty. Please make sure that:

  • you are using the latest version of the build-wrapper and the CFamily analyzer
  • your compiler is supported
  • you are wrapping your build correctly
  • you are wrapping a full/clean build

If someone needs full debug log file then I can send it over along with the build-wrapper-dump.json.

Thanks,
Avay

1 Like

Hi Avay,

First, SonarQube 9.5 is a bit stale at this point. The current version is 9.8, with SonarQube 9.9 LTS out tomorrow.

Before you switched your compiler, was analysis working?

 
Ann

Yes, it was working with the old compiler - armr5-none-eabi-gcc.exe (GNU Tools for ARM Embedded Processors) 8.2.0 . Do you want to take a look at full debug file(generate using -x command) ?

Hello @Abhayak,

They can be very useful to debug the issue, thanks. I can send you a private message if you do not want them to be public.

@aalvarez please send me a direct message so I can share the debug log with you. Thanks for your support!

I checked the changelog and there have been some fixes in the build wrapper since 6.34, which is the one you have, that may improve the situation. Could you update to 9.9 and give it another try?


I tried to download the build wrapper as shown in the screenshot but it keeps download 6.34 version. Is it because I am using sonarqube version 9.5 which is old. Should I upgrade the sonarqube first then download the build wrapper?

Exactly.

I just upgraded my sonarqube to 9.9.0.65466. But when I download the buildwrapper using this method " * Download Build Wrapper for Linux from {SonarQube URL}/static/cpp/build-wrapper-linux-x86.zip", it keeps downloading the older version 6.34.

Here are my logs from the upgraded sonarqube 9.9 execution
sonarqube-9.9-exeution-log.txt (1.8 MB)
@aalvarez @balazs.benics
build-wrapper-dump-sonarqube9.9.json (507 Bytes)

The below screenshot shows how our build pipeline access the build wrapper. Basically, it gets downloaded every time the pipeline is kicked in, and, then, it gets unzipped.

Hello,

Sonarqube is properly updated. The CFamily analyzer version is the latest (6.41 we can see in the json and sonar-scanner logs).

There should be a build-wrapper.log stored next to build-wrapper-dump.json. They are both created and closed together, so if the json is there, and properly formed, the log should be. Can you double check that .log file is preserved on your CI?

Without that log is going to be difficult to find out what is happening. We need to know what process executions the build wrapper is seeing.

Hey @aalvarez,

Sorry, previously, the Jenkins was ignoring and not copying the build-wrapper.log files to the correct output folder. Now, I have the build-wrapper.log files. There two files attached to the zip folder below and they are generated separately for two different types of builds, meaning using two different sets of source files.
build-wrapper-logs.zip (904.2 KB)

Thanks,
Avay

From what I can see, armr5-none-eabi-gcc is not a binary, but a bash script that calls arm-xilinx-eabi-gcc.real. This explains why the build wrapper does not capture the compiler: the first executable is bash and the second end with an unexpected .real

I have added a ticket to our backlog [CPP-4115] - Jira

As a workaround, since you are using cmake you can generate a compilation database using CMAKE_EXPORT_COMPILE_COMMANDS and point sonar-scanner to the generated file using sonar.cfamily.compile-commands

You will also have to comment out or remove the property that points to the build wrapper.

Hey Alejandro,

I was able to run the sonarqube successfully with the help of CMAKE_EXPORT_COMPILE_COMMANDS. I really appreciate for your support.

I checked the compiler and it’s a binary executable not a bash script. Also, added the compiler to this discussion if you want to take a look at it. Maybe somehow this compiler is not supported by sonarqube?

compiler.zip (11.6 KB)

Thanks,
Avay

I am glad it worked!

armr5-none-eabi-gcc.exe is a Windows executable indeed, but the logs you sent are from a Linux machine. And this is what hints that it is a wrapper of the actual compiler:

Thu Feb 16 16:39:22 2023: executable: </bin/bash>
Thu Feb 16 16:39:22 2023: argv[0]: </bin/bash>
Thu Feb 16 16:39:22 2023: argv[1]: </tools/Xilinx/SDK/2019.1/gnu/armr5/lin/gcc-arm-none-eabi/bin/../x86_64-oesdk-linux/usr/bin/arm-xilinx-eabi/arm-xilinx-eabi-gcc>

Is there any update on this ticket [CPP-4115] - Jira ? I am facing similar issue moving from gcc 8 to gcc 11. Where a bash script calls the executable ending with “.bin” .

Hi @sindhuja,

Welcome to the community!

If there were any updates, you would see them in Jira.

 
Ann