C++ make "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)
    SonarScanner 4.7.0.2747
    GCC Version: 5.4.0
    build-wrapper-linux-x86-64 version 6.41.1

  • how is SonarQube deployed: zip, Docker, Helm
    Full package is deployed In local repo for testing

  • what are you trying to achieve
    Trying to Scan C++ Project using “make”
    build-wrapper-linux-x86-64 --out-dir bw-output make install

Getting the following error:

       17:21:19.121 WARN:
"sonar.cfamily.cache.enabled" and "sonar.cfamily.cache.path" properties are deprecated.
Visit the documentation page for more information about analysis cache configuration
  https://docs.sonarqube.org/9.9/analyzing-source-code/languages/c-family/
17:21:19.121 INFO: Cache is explicitly disabled: sonar.cfamily.cache.enabled=false
17:21:19.133 INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 0 (forceInclude=0,throughHeader=0)
17:21:19.133 INFO: SE: 0 out of 0
17:21:19.133 INFO: Z3 refutation rate: 0 out of 0
17:21:19.133 INFO: Subprocess(es) done in 12ms
17:21:19.134 INFO: 0 compilation units analyzed
17:21:19.165 INFO: ------------------------------------------------------------------------
17:21:19.165 INFO: EXECUTION FAILURE
17:21:19.165 INFO: ------------------------------------------------------------------------
17:21:19.166 INFO: Total time: 17.418s
17:21:19.256 INFO: Final Memory: 40M/320M
17:21:19.256 INFO: ------------------------------------------------------------------------
17:21:19.256 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

Content of JSON file:

cat bw-output/build-wrapper-dump.json
# (C) SonarSource SA, 2014-2022, info@sonarsource.com
# All SONARSOURCE programs and content are copyright protected.
# SONARSOURCE and SONARQUBE are trademarks of SonarSource SA. All rights are expressly reserved.
#
# This file is designed exclusively for use with the SONARSOURCE C / C++ / Objective-C Plugin.
# It may not be used in connection with any other software.
# Any other use is prohibited by law and may be grounds for immediate termination of your License.
{
"version":"6.41.1",
"captures":[

build-wrapper.log

build-wrapper.log (799.9 KB)

Hi,

Welcome to the community!

What version of SonarQube are you using?

 
Thx,
Ann

Hi Ann
SonarScanner 4.7.0.2747

thanks

Hi,

I’m asking about the version of SonarQube. Check the page footer if you’re not sure.

 
Thx,
Ann

  • Data Center Edition
  • Version 9.9.4 (build 87374)
1 Like

Hi,

Thanks for those details.

Sorry I didn’t ask this earlier, but

Does the JSON file really end like that, with an unmatched bracket and no closing curly brace?

 
Thx,
Ann

sorry. I didnt copy it fully -

 cat bw-output/build-wrapper-dump.json
# (C) SonarSource SA, 2014-2022, info@sonarsource.com
# All SONARSOURCE programs and content are copyright protected.
# SONARSOURCE and SONARQUBE are trademarks of SonarSource SA. All rights are expressly reserved.
#
# This file is designed exclusively for use with the SONARSOURCE C / C++ / Objective-C Plugin.
# It may not be used in connection with any other software.
# Any other use is prohibited by law and may be grounds for immediate termination of your License.
{
"version":"6.41.1",
"captures":[
]}

Hi,

Thanks for the full file. So now let’s back up to your build. Can you share your pipeline?

 
Ann

I am building this locally not as part of the pipeline. I am having the same problem in Jenkins as well. What details do you need? Can you be more specific please?

Hi,

I’m interested in how you’re generating the build-wrapper file. Could you share your compile and analysis commands?

 
Thx,
Ann

Sorry. I thought I have shared that already.

 curl ${LS_SONAR_SERVER}/static/cpp/build-wrapper-linux-x86.zip -o build-wrapper-linux-x86.zip -k #&& \
                         unzip build-wrapper-linux-x86.zip #&& \
                        rm -f build-wrapper-linux-x86.zip

                        echo "########## Start Build"
                        ${ACE_BUILD_WRAPPER_DIR}/build-wrapper-linux-x86-64 --out-dir bw-output make clean all  DEBUG=1 TEST=Y -j5

I can run “make clean all DEBUG=1 TEST=Y -j5” successfully

Hi,

And what compiler are you using?

 
Thx,
Ann

GCC Version: 5.4.0
Specified in my original posting.

Hi,

Sorry I overlooked that.

I’ve flagged this for the language experts.

 
Ann

Thanks Ann. Any idea on the ETA for the team’s response?

Hey @sri.raghav,

From the log you shared I see that the compiler you are using is /apps/var/opt/123456/dev/orch/XENVBASE/gcc_gnu/X/5.4.0/bin/_g++. _g++ isn’t recognized as supported compiler name. Where does this name come from? is it possible to to rename it to g++ so that build-wrapper captures it and the JSON wouldn’t be empty?

thanks,

1 Like

Thats interesting. We are not referring to _g++ any where though. _g++ and g++ seems to be different binary but same version

bash-4.4$ md5sum /apps/var/opt/123456/dev/orch/xenv/gcc_gnu/X/5.4.0/bin**/_g++**
2181875e4d4f1098d0288d992c6504a3  /apps/var/opt/123456/dev/orch/xenv/gcc_gnu/X/5.4.0/bin/_g++

bash-4.4$ md5sum /apps/var/opt/123456/dev/orch/xenv/gcc_gnu/X/5.4.0/bin/**g++**
784ed42e745a0b62b7ae7164e3add2d6  /apps/var/opt/123456/dev/orch/xenv/gcc_gnu/X/5.4.0/bin/g++
bash-4.4$ vim PTM/bw-output/build-wrapper.log
bash-4.4$ /apps/var/opt/123456/dev/orch/xenv/gcc_gnu/X/5.4.0/bin/_g++ --version
_g++ (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-4.4$ /apps/var/opt/123456/dev/orch/xenv/gcc_gnu/X/5.4.0/bin/g++ --version
_g++ (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I did some digging. _g++ is the actual binary and g++ is a script. Hope this helps. Please let me know if you have any questions

cat g++

#!/bin/sh
[ -z "${XDEBUG}" ] || echo "Input Arguments = $@"

# set Base Compiler Dir , include , bin
CCBASEDIR=${XENVBASE}/gcc_gnu/X/${GCC_GNU_REL}
CCBINDIR=${CCBASEDIR}/bin
CCINCDIR=${CCBASEDIR}/include

export CCBASEDIR CCBINDIR CCINCDIR

##  include directory paths
INCDIRS="-isystem ${SGSBASE}/usr/include -isystem ${SGSBASE}/usr/include/sys -I${CCINCDIR}"

## libraries to include
LOADLIBS="-L${SGSBASE}/usr/lib64 -L${SGSBASE}/lib -L${SGSBASE}/tls/lib"

## set Prefix
BPREFIX="-B${SGSBASE}/usr/lib64 -B${SGSBASE}/usr"

[ -z "${XDEBUG}" ] || echo -e "\n-DEBUG> exec ${CCBINDIR}/_g++ ${BPREFIX} ${INCDIRS} "$@" ${LOADLIBS} "

exec ${CCBINDIR}/_g++ ${BPREFIX} ${INCDIRS} "$@" ${LOADLIBS}