java.lang.IllegalStateException : The "build-wrapper-dump.json" file was found empty

Hello everyone, I have a problem.

I am using Windose 7, compiler for CCS 3.3 using TI 2000 for SonarCloud.
Last time I failed to compile due to using the wrong compiler, and now I am still getting the same error as before after changing to the above compiler.
Here are the problems I encountered.

17:45:58.818 INFO: 0/114 files marked as unchanged
17:45:58.819 INFO: Cache: 0/0 hits, 125 bytes
17:45:58.820 INFO: 0 compilation units analyzed
17:45:59.547 INFO: ------------------------------------------------------------------------
17:45:59.548 INFO: EXECUTION FAILURE
17:45:59.551 INFO: ------------------------------------------------------------------------
17:45:59.552 INFO: Total time: 1:25.570s
17:45:59.881 INFO: Final Memory: 39M/134M
17:45:59.881 INFO: ------------------------------------------------------------------------
17:45:59.882 ERROR: Error during SonarScanner execution
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 you are building your project inside a Docker container, build-wrapper is wrapping the build process inside the container and not wrapping the external Docker process
        at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:484)
        at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:212)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:468)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:464)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:420)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        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(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

I can provide files for build-wrapper.log, build-wrapper-dump.json, SonarCloud.bat
I hope this problem can be solved.
Thank you in advance.

type or paste code here

Hello @EDChang, and thanks for your patience,

Yes, that would be helpful. If you feel these files contain sensitive data, I can send you a private message to share them privately.

Could you also share which exact command you used to execute the build wrapper and the scanner?

Thanks

Hello Marco !

Can you give me a PM?

Sure, I just did.

Thanks, @EDChang, for sharing the files with me.

I’m not familiar with the build process for C2000, but here are things you should be able to check:

  • Is the command in sonarCloud.bat doing a clean build? All files must be compiled for build-wrapper to see the compiler invocations and record the necessary information for the analysis.
  • It seems other people use eclipsec.exe to build C2000 projects from the command line. I also found this documentation about eclipsec.exe, but you may have to upgrade your CCS version.
  • If you figure out how to do a clean build with CCS 3.3, it is possible build-wrapper may still not work. In that case, I would encourage you to upgrade if you can since this version wasn’t updated since 2009.

I hope this helps.

Umm. Sorry can you explain more clearly, what is “clean build”.
I see more different compiler have different “clean build” write method,
How do I know how to write “Clean build” in CCS or eclipsec ?
your recommendation, I will discuss with my supervisor.
Tks. marco.

Hi @EDChang

By clean build, I mean all intermediate and output files were deleted, leaving only the project and component files before doing the actual build. The exact process depends on the build tools. You can find some examples in our documentation, but they are not specific to CCS. Unfortunately, I’m unfamiliar with CCS to provide a solution that works out of the box. But the documentation I shared previously for modern CCS versions should cover this.

HTH

HI marco,

I listened to your advice, up CCS3 to CCS7, the CMD have show “analysis success”.
but why my sonarcloud didn’t analysis results are displayed?

Can You Cheak again my build-wapper.log and build-wapper-dump.json ?

Hi @EDChang,

I’m glad you could make some progress on the issue. Let’s try to figure out the rest.

To fully understand what you mean, could you share the build-wapper.log and build-wapper-dump.json and the entire output from the scanner invocation? You can use the same private thread if you think sensitive data is in those files.

Cheers,

Hello Marco

I am sorry, I can not find you give my PM, So the build-wapper.logand “build-wapper-dump.json” , I put it here.

build-wrapper-dump.txt (512.4 KB)
build-wrapper.log (1.3 MB)

Thanks you, you help me to Solution my question.
Have a nice day to you.

Hi @EDChang

Thanks for the files. I see the build wrapper database looks better now.

However, I also need the entire output from the scanner invocation to understand the issue you’re facing. You can find the instructions to run the scanner with the build wrapper output on this page: Analysis Steps Using Build Wrapper.

HTH

Hi @EDChang,

Thanks for sharing the logs privately.

Looking at them, I see you run the scanner from the TI installation directory and that your project lives in a subdirectory on your desktop. This is not compatible with the instruction to run the scanner:

  • Execute the SonarScanner (sonar-scanner) from the root directory of your project.

You will find other similar requirements on the page I linked previously. The best would be to run both the build wrapper and the scanner from the root of your project. This simplifies how you can refer to the build wrapper output in your sonar-project.properties since the path has to be relative.

You can also find information on how the analysis scope can be defined and how this impacts the selection of files to analyze here:

HTH

Hello marco,

Thank you for teaching me the importance of location.
I have put my code in the same folder as sonar-project.properties, and after several attempts, I have the same fault, and at the end of the analysis it runs the following fault.

An error occurred while analyzing the following compilation unit:
C:/ti/ccsv7/eclipse/36-004153-01G/1.Source Code/MAX8k_28066/Debug/…/APP/BusBatProt.C
A file named “sonar-cfamily-reproducer.zip” has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
C:\ti\ccsv7\eclipse\sonar-cfamily-reproducer.zip

The "sonar-cfamily-reproducer.zip " I have sent it to you from the PM.

Sorry my questions are very many and complicated, and my English is not that good, it takes a little time to understand, thank you again for helping me solve the problem!

Hi @EDChang, and thanks for your patience.

I finally had the time to look at the files you shared.

There are a few things worth sharing here. First, there’s this warning:

09:54:27.032390100 WARN 
File
  [path]\build-wrapper-dump.json
was generated using build-wrapper version 6.38,
which does not match the analyzer version 6.39.0.60440.

Please download the matching version from the server
  https://sonarcloud.io/static/cpp/build-wrapper-win-x86.zip

I recommend regenerating the build wrapper output with the mentioned version. While it will not address your current problem, this will avoid other unrelated issues in the future.

The other thing is on our side: unfortunately, at the moment, the error message is not clear, and we need to improve it. Essentially, you are still using a fairly old version (CCS v7 was released more than 5 years ago if I’m not mistaken) that we don’t support. With [CPP-3940] - Jira, we aim at improving the error message, but that ticket doesn’t aim at supporting that old compiler version.

We also have [CPP-3986] - Jira to record requests to support older compiler versions.

Thankfully, I believe upgrading to a recent version of CCS (and thus a supported version of the compiler for C2000) should resolve your issues.

I hope this helps, and do let me know if you face other issues.

1 Like

Hi Marco !!

I’ve read your reply and I think I will discuss with my supervisor again whether to use the newer CCS version or not, for now it should just be a change of version and everything will run smoother after that!

Thank you for your help this period, I have learned a few things.

Have a nice day.