which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube Scanner 4.0.0.1744
Java 11.0.3 AdoptOpenJDK (64-bit)
Linux 5.4.0-91-generic amd64
SonarQube server 8.9.1
CFamily plugin version: 6.20.1.32841
what are you trying to achieve
I have a project which has kotlin, java and C++ code. Java and Kotlin code smells are working fine, but when it comes to C++ I am getting following error.
INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 0 (forceInclude=0,throughHeader=0)
INFO: SE: 0 out of 0
INFO: Subprocess(es) done in 24ms
INFO: 0 compilation units analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 56.770s
INFO: Final Memory: 42M/188M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner 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:442)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:175)
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)
what have you tried so far to achieve this
Instead of C++, if I enable CXX, it works fine, I mean I get the code smells and issues on dashboard.
Due to security reasons, I can’t share build-wrapper.log or json
Alternate : I tried to copy C++ rules to CXX - Seems not possible. Is there anyway I can do that ?
you are now wrapping the build call with the build-wrapper, you are currently wrapping the cmake configuration call, to have correct C++ analysis you should change the sonar-scanner call to the following:
Error during SonarQube Scanner execution **13:13:59** ERROR: Language of file 'controller/CMakeFiles/3.18.1/CompilerIdCXX/CMakeCXXCompilerId.cpp' can not be decided as the file matches patterns of both sonar.lang.patterns.cxx : **/*.cpp and sonar.lang.patterns.cpp : **/*.h,**/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp
Trails:
I added "-Dsonar.cxx.file.suffixes=- " to disable CXX and tried again but got below error.
13:15:48 ERROR: Error during SonarQube Scanner execution
13:15:48 java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found empty. Please make sure that:
13:15:48 * you are using the latest version of the build-wrapper and the CFamily analyzer
13:15:48 * your compiler is supported
13:15:48 * you are wrapping your build correctly
13:15:48 * you are wrapping a full/clean build
13:15:48 * 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
13:15:48 at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:442)
13:15:48 at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:175)
13:15:48 at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
I feel I am making a mistake in sonar scanner command but I am not able to pinpoint it exactly.
the sonar-cxx plugin is not supported by SonarSource, I recommend either uninstalling it or referring to their support channel if interferes with the SonarSource CFamily plugin.
@mpaladin ,
I recommend either uninstalling it or referring to their support channel if interferes with the SonarSource CFamily plugin.
If possible could you provide links to their support channel.
And if possible could you tell me with the command you suggested I got the following error. What could be cause or any solution you want me to try.
=============================
Error during SonarQube Scanner execution **13:13:59** ERROR: Language of file 'controller/CMakeFiles/3.18.1/CompilerIdCXX/CMakeCXXCompilerId.cpp' can not be decided as the file matches patterns of both sonar.lang.patterns.cxx : **/*.cpp and sonar.lang.patterns.cpp : **/*.h,**/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp
=============================
I don’t think that they can co-exist, I highly recommend that you pick one or the other, just uninstall sonar-cxx and give it a try. About their support channel just use any search engine to find their page and their support channel.
@mpaladin
We un-installed sonar-cxx from MarketPlace in sonarqube UI. We tried different combinations of commands on sonar-scanner, but all of them ended on same error message.
15:44:26 ERROR: Error during SonarQube Scanner execution
15:44:26 java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found empty. Please make sure that:
15:44:26 * you are using the latest version of the build-wrapper and the CFamily analyzer
15:44:26 * your compiler is supported
15:44:26 * you are wrapping your build correctly
15:44:26 * you are wrapping a full/clean build
15:44:26 * 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
15:44:26 at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:442)
15:44:26 at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:175)
Result was same: Complete C++ report, and below error while compiling.
Logs:
**21:35:39** The analyzer was not able to find file **21:35:39** android/log.h **21:35:39** included from file /mnt/spinner/jenkins/workspace/Sonarqube/daip_sonarqube_bitbucket_PCV_gen2/controller/ext/include/android/log/log.h **21:35:39** included from file /mnt/spinner/jenkins/workspace/Sonarqube/daip_sonarqube_bitbucket_PCV_gen2/controller/../aosp/diraceffect/gef_log.h **21:35:39** included from file /mnt/spinner/jenkins/workspace/Sonarqube/daip_sonarqube_bitbucket_PCV_gen2/controller/../aosp/diraceffect/dirac_effect.h **21:35:39** included from file /mnt/spinner/jenkins/workspace/Sonarqube/daip_sonarqube_bitbucket_PCV_gen2/aosp/diraceffect/gef-effect.cpp
are you able to get a successful build without build-wrapper? Could you try to get a successful build without build-wrapper and post the commands sequence?