Hello colleagues!
I’m trying to scan my core project using sonar-scanner. Building using a build wrapper is successful.
And I get this error:
ERROR: Error during SonarScanner 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 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
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:446)
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)
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)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
Steps:
I cloned the project from GitHub
Downloaded and unpacked the latest version of the build wrapper in the project directory
Downloaded and unpacked the latest version of the sonar scanner in the project directory
Ran build wrapper from the project directory via command:
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make TARGET=x200 clean all pkg
This building step was completed successfully, and the directory bw-output with files build-wrapper.log and build-wrapper-dump.json appeared
Then I ran the sonar scanner step via command:
./sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner -Dsonar.projectKey=myproj -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=https://sonarqube.projhost.com -Dsonar.login=xxxff30dcaee83dd359a77b0c8ad7b8e841be6e2 -Dsonar.sourceEncoding=utf-8 -Dsonar.cfamily.threads=4 -Dsonar.exclusions=**/*.java,**/*.html -Dsonar.cfamily.cache.enabled=false
And after that, I got the error that I described above.
My configuration:
uname -a
Linux 8def5200109a 5.15.0-1023-aws #27-Ubuntu SMP Thu Oct 20 16:44:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.6 LTS"
./sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner --version
INFO: Scanner configuration file: /usr/src/loki/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.15.0-1023-aws amd64
./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --version
build-wrapper, version 6.20 (linux-x86)
Copyright (C) 2014-2021 SonarSource SA, info@sonarsource.com
What about questions:
- you are using the latest version of the build-wrapper and the CFamily analyzer
Yes, I use the latest versions - 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
Yes, I use the same commands for my previous project on the same machine, and everything works properly there. My compiler is supported, and I run cleaning before too - you are providing the path to the correct build-wrapper output directory
Yes, the path is correct - you are building and analyzing the same source checkout
Yes, I’m building and analyzing absolutely the same source checkout in the same directory - absolute paths must be identical in build and analysis steps
I don’t understand what it means. I run commands in the same project directory. It looks like absolute paths are identical
Also, I saw identical issues on the community forum, but I couldn’t find a solution.
If I got it right indexed files don’t exist. However, I don’t understand why it happens and how I can fix it. Because I just run command as usually, as on my previous projects.
build-wrapper-dump.json and build-wrapper.log attached to the topic
Thank you very much in advance!
build-wrapper-dump.zip (691.1 KB)
build-wrapper.log