# Sonar C++ wrapper failing in parsing build-wrapper-dump.json

**URL:** <https://community.sonarsource.com/t/sonar-c-wrapper-failing-in-parsing-build-wrapper-dump-json/62561>\
**Category:** SonarQube Server / Community Build\
**Tags:** cfamily\
**Created:** [May 3, 2022, 11:20am UTC](https://community.sonarsource.com/t/sonar-c-wrapper-failing-in-parsing-build-wrapper-dump-json/62561 "2022-05-03T11:20:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Himanshu\_Tyagi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/himanshu_tyagi/32/31095_2.png) [@Himanshu\_Tyagi](https://community.sonarsource.com/u/Himanshu_Tyagi)\
**Post date:** [May 3, 2022, 11:20am UTC](https://community.sonarsource.com/t/sonar-c-wrapper-failing-in-parsing-build-wrapper-dump-json/62561/1 "2022-05-03T11:20:53Z")

</div>

Hi Team,  
Please help for the issue of C++ project.

I am able to generate the json file. and running build command and sonar scanner with wrapper as both running in same instance of compose. All is well till json creation but when it parses it gives below error.

10:40:41.272 DEBUG: ‘src/agent/config.cc’ generated metadata with charset ‘UTF-8’  
10:40:41.286 INFO: Cache is explicitly disabled: Optional[false]  
10:40:41.299 WARN:  
File  
/mywork/proj/wrapper\_OUTPUT/build-wrapper-dump.json  
was generated using 6.20.3 build-wrapper version,  
which does not match analyzer 6.20.4.45706 version.

Please download matching version from the server  
[http://192.168.29.213:9000/static/cpp/build-wrapper-linux-x86.zip](http://192.168.29.213:9000/static/cpp/build-wrapper-linux-x86.zip)

10:40:41.347 INFO: ------------------------------------------------------------------------  
10:40:41.347 INFO: EXECUTION FAILURE  
10:40:41.347 INFO: ------------------------------------------------------------------------  
10:40:41.347 INFO: Total time: 17.778s  
10:40:41.399 INFO: Final Memory: 20M/70M  
10:40:41.399 INFO: ------------------------------------------------------------------------  
10:40:41.399 ERROR: Error during SonarScanner execution  
java.lang.IllegalStateException: java.io.EOFException: End of input at line 155 column 16 path $.captures[7]  
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:629)  
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:373)  
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:177)  
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)  
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)  
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)  
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)  
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)  
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)  
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:392)  
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:388)  
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357)  
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)  
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)  
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150)  
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)  
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)  
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)  
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)  
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)  
Caused by: java.io.EOFException: End of input at line 155 column 16 path $.captures[7]  
at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1395)  
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:466)  
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:413)  
[build-wrapper-dump.json](https://community.sonarsource.com/uploads/short-url/pTRgRBmDDVyHcGrSrY4A6bzdneZ.json) (73.4 KB)

---

<div class="post-metadata">

**Author:** ![Amelie](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/amelie/32/66942_2.png) [@Amelie](https://community.sonarsource.com/u/Amelie)\
**Post date:** [May 3, 2022, 2:15pm UTC](https://community.sonarsource.com/t/sonar-c-wrapper-failing-in-parsing-build-wrapper-dump-json/62561/3 "2022-05-03T14:15:45Z")

</div>

Hello @Himanshu_Tyagi and welcome to our community!

Your `build-wrapper-dump.json` is incomplete so the analysis is failing. It means that the execution of your build with `build-wrapper` did not succeed.

Could you re-run the build-wrapper with your clean build command and make sure that the build succeeded? If it succeeds, could you share the `build-wrapper.log` please?

---

<div class="post-metadata">

**Author:** ![Himanshu\_Tyagi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/himanshu_tyagi/32/31095_2.png) [@Himanshu\_Tyagi](https://community.sonarsource.com/u/Himanshu_Tyagi)\
**Post date:** [May 3, 2022, 3:56pm UTC](https://community.sonarsource.com/t/sonar-c-wrapper-failing-in-parsing-build-wrapper-dump-json/62561/4 "2022-05-03T15:56:44Z")

</div>

I did investigate on this again based on your comment. And I am success in doing this using sonarscanner cli. But I want it through gradle and it is failing saying.

Caused by: java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:

- you are using the latest version of the build-wrapper and the CFamily analyzer
- you are correctly invoking the scanner with correct configuration
- your compiler is supported
- you are wrapping your build correctly
- you are wrapping a full/clean build
- you are providing the path to the correct build-wrapper output directory
- you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps

---

<div class="post-metadata">

**Author:** ![Amelie](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/amelie/32/66942_2.png) [@Amelie](https://community.sonarsource.com/u/Amelie)\
**Post date:** [May 5, 2022, 9:55am UTC](https://community.sonarsource.com/t/sonar-c-wrapper-failing-in-parsing-build-wrapper-dump-json/62561/5 "2022-05-05T09:55:37Z")

</div>

Did you disable the Gradle daemon (`--no-daemon`) while building with `build-wrapper`?

In order to help you, could you please share the `build-wrapper.log` as well as the `build-wrapper.json`?
