CentOS/GCC/SonarScanner for Jenkins ERROR: Error during SonarQube Scanner execution java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed

  • Enterprise Edition - Version 8.1 (build 31237)
    with SonarCFamily Code Analyzer for C, C++, Objective-C * 6.7.0 (build 15300) installed

When trying to scan our project which is Built on CentOS 7 with GCC

15:02:28.873 INFO: Subprocess(es) done in 1948ms
15:02:28.879 INFO: Cache: 0/0 hits, 135 bytes
15:02:28.879 INFO: 0 compilation units analyzed
15:02:29.026 INFO: ------------------------------------------------------------------------
15:02:29.026 INFO: EXECUTION FAILURE
15:02:29.026 INFO: ------------------------------------------------------------------------
15:02:29.027 INFO: Total time: 16.584s
15:02:29.089 INFO: Final Memory: 30M/104M
15:02:29.089 INFO: ------------------------------------------------------------------------
15:02:29.089 ERROR: Error during SonarQube Scanner execution
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 SonarCFamily 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
    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:357)
    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:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:386)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:382)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:351)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    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)

The plugins are the latest version.
Build-wrapper-dump.json is attached in this thread.

The build is clean and complete.

Some assistance to troubleshoot would be appreciated.

build-wrapper-dump part 1.txt (943.2 KB)

Hi @mburman,

I can only see compilation of files conftest.c and conftest.cpp which I don’t believe are your files. What compiler and build system are you using? Are you running a clean build?

Massimo,

We are using GCC compiler both and clang onto a native Centos7. Currently our build process is invoked with manual commands /sandbox/untriage/sonar-scanner-4.2.0.1873-linux/bin/sonar-scanner -X -Dsonar.projectKey=ftcore-ax -Dsonar.projectVersion=2.8.0.0 -Dsonar.sources=./ -Dsonar.host.url=http://134.111.32.115:9000 -Dsonar.login=f9108ea61403c3e94b9558e4e637492029a0409d -Dsonar.scm.provide=git -Dsonar.cfamily.build-wrapper-output=/sandbox/ftcbuild/demo1/ but it will be done with Jenkins for continuous integration in the near future.

This is a development build which does include some points for testing, which is the reason for conftest, but we can try to pull it out and see if it does complete.

We are getting complete builds, but just the json does not appear to be analyzing.

The build-wrapper-dump was too large to upload, so that was only a subset (original was 616,024 lines at 35.5MB)

Hi @mburman,

are you analyzing the same checkout of the build? Do the absolute paths in the build-wrapper-dump.json file and the sonar-scanner correspond?

We are analyzing same checkout the build. When I building product I am building wrapper.json file in different path like

/sandbox/untriage/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir /sandbox/ftcbuild/demo1 make rpm

And sonar scanner is available

/sandbox/untriage/sonar-scanner-4.2.0.1873-linux/bin/sonar-scanner

Hi @mburman,

I would need you to share your build-wrapper-dump.json file and the output of sonar-scanner. You can compress them before uploading them, size will drop by a while.

For compressing the files, I can only upload .txt files image

However my files are
image

do we have another method for uploading a compressed file? Or a direct contact method?

Hi @mburman,

compress the file, i.e. with zip, then rename the file to .txt to be able to upload it.

build wrapper dump.txt (424.1 KB) scanner output.txt (1.1 KB)
Please see attached, however note that in converting .zip to .txt the files may become unstable

build wrapper log part 1.txt (1.7 MB) build wrapper log part 2.txt (3.0 MB) more information

@mpaladin did you happen to take a look?

Did you have any input or comments on what might be going wrong?

Thanks

Hi @mburman,

sorry for the delay, busy times.

I had a look and the scanner output.txt file is not complete, it contains only the last few lines, could you share the full scanner output please?

Sure, please see attached.
sonar-outut.txt (200.4 KB)

Hi @mburman,

looking at your files the absolute paths don’t match, this is why nothing is being analyzed. An example, in build-wrapper-dump.json file I see:

/sandbox/sandbox1/ftcbuild/demo/ftcore-build/ftcore-ax/rpmbuild/BUILD/lsb-ft-core-unity-ax-2.8.0.0/scp/scp.c

in the sonar-scanner output the absolute path is:

/sandbox/ftcbuild/demo/ftcore-build/ftcore-ax/scp/scp.c

@mpaladin so we made some adjustments to make sure our paths are the same, however still getting the same issues.

Would you be able to assist in reviewing our output (attached)sonar_scanner_out.txt (80.5 KB) buildwrapperdump.txt (423.8 KB)

Please note that build-wrapper-dump.txt is actually a zipped file.