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

Hello,

I try to analyse a project and I applied the following steps, eventually I have ‘“build-wrapper-dump.json” file was found empty’ error. However, I can see that the file has a content (whether it is meaningful or not) Would you please help me?

  1. I change the memory use for SonarQube since otherwise it fails with the error java.lang.OutOfMemoryError: Java heap space:
    # export SONAR_SCANNER_OPTS="-Xmx16384m -XX:MaxPermSize=16384m -XX:ReservedCodeCacheSize=2048m

  2. I run the following line to use a script to use the wrapper (compile.sh has source, lunch and build commands that use make, the script compiles the project successfully):
    # ../build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bwoutput ../compile.sh

  3. I run the following command with the correct values that I got from SonarQube server:
    ../sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner -Dsonar.projectKey=<key_info> -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bwoutput -Dsonar.host.url=http://sonarqubetestserver -Dsonar.login=<value> -Dsonar.cfamily.threads=4 -X

  4. After a long analysis, I get the following 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

Thank you


Versions:

# make --version
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


# ./sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner --version
INFO: Scanner configuration file: /home/sonar-scanner-4.7.0.2747-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Linux 5.4.0-124-generic amd64

# ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --version
build-wrapper, version 6.32 (linux-x86)
Copyright (C) 2014-2022 SonarSource SA, info@sonarsource.com

Usage: ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir <output directory> <build command>

Hi,

Welcome to the community!

Thanks for providing versions! Can you also check your SonarQube page footer and provide the version of the SonarQube server?

 
Thx!
Ann

Hello,

The SonarQube Server has Enterprise Edition - Version 9.4 (build 54424).

Thank you

Hello Ann,

At this point, I feel a bit stucked. Would you please show me some points to check and/or consider to be able to continue?

Thank you

Hi,

I’ve flagged this for more expert attention.

 
Ann

1 Like

Hi @cppdev,

Are you trying to analyze languages other than C, Obj-C, and C++? because this error should appear before the analysis of those languages starts.

  • What compiler are you using?
  • Does compile.sh clean build you project? the clean part is essential for the build-wrapper to work.
  • Can you share the output of ../build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bwoutput ../compile.sh and the build-wrapper.json and .log files? If you prefer I can send you a private message to share them privately.

Build-wrapper JSON is supposed to contain the entry for all the files compiled with your compile.sh.

Thanks,

Hello @Abbas,

Thank you for the help. I have been collecting answers for all the questions, and I need to ask some of them to other developers. Would you please send me a private message? I will try to make them ready by tomorrow.

Regards
Thank you

1 Like

Hello @cppdev,
the build-wrapper JSON is empty. we already faced a similar issue with the exotic build system. Here is the ticket for android AOSP: [CPP-2372] - Jira

As a workaround, I suggest that you use a compilation database instead of the build-wrapper.
Soong build system supports generating compilation database internally:

Compdb (compile_commands.json) Generator
export SOONG_GEN_COMPDB=1

More on compilation database:

Thanks,

1 Like

Hello @Abbas

Thank you, I will check these links.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.