Hello,
Hope you are doing good!
Need a help with c,c++ scan issue on Ubuntu 18.04 or 20.04
- SonarQube server version: Data Center EditionVersion 9.9 (build 65466)
SonarQube scanner cli version: SonarScanner 4.8.0.2856
Build wrapper version: build-wrapper-linux-x86-64 version 6.41 (linux-x86)
We are trying to analyze c,c++ code using sonarQube and facing below error during the scan:
13:06:55.807 DEBUG: Not enough content in 'devices/fansystem/translator/fan_system_translator_errors.cpp' to have CPD blocks, it will not be part of the duplication detection
13:06:55.900 DEBUG: Not enough content in 'devices/bmc_standard/logical/bmc_errors_standard.cpp' to have CPD blocks, it will not be part of the duplication detection
13:06:56.140 DEBUG: Not enough content in 'devices/bmc_fru_prom/builder/bmc_fru_prom_ld_builder.h' to have CPD blocks, it will not be part of the duplication detection
13:06:56.227 INFO: Found empty cache on server
13:06:56.282 DEBUG: Probing compiler: [/usr/bin/ccache, -x, c++, --std, c++17, -v, -dM, -E, -]
13:07:06.372 INFO: ------------------------------------------------------------------------
13:07:06.372 INFO: EXECUTION FAILURE
13:07:06.372 INFO: ------------------------------------------------------------------------
13:07:06.373 INFO: Total time: 1:05.091s
13:07:06.615 INFO: Final Memory: 97M/388M
13:07:06.615 INFO: ------------------------------------------------------------------------
13:07:06.615 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException:
The compiler execution timed out, make sure that:
* the analysis is running on appropriate hardware
* eventual compiler license check over network is not taking too much time
The executed process:
[/home/jenkins/anu/full_build/chameleon-plugin/.scannerwork/.sonartmp/613699590374514809/subprocess, -exec, /usr/bin/ccache, g++, -x, c++, --std, c++17, -v, -dM, -E, -]
at com.sonar.cpp.driver.ProcessExecutor.execute(ProcessExecutor.java:59)
at com.sonar.cpp.driver.ProcessExecutor.execute(ProcessExecutor.java:44)
at com.sonar.cpp.analyzer.ClangDriver.lambda$probeCompiler$9(ClangDriver.java:759)
at java.base/java.util.HashMap.computeIfAbsent(Unknown Source)
at com.sonar.cpp.analyzer.ClangDriver.probeCompiler(ClangDriver.java:749)
at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:488)
at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:34)
at com.sonar.cpp.plugin.CFamilySensor.lambda$process$17(CFamilySensor.java:908)
at com.sonar.cpp.plugin.BuildWrapperJsonReader.readCaptures(BuildWrapperJsonReader.java:86)
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:905)
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:410)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
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:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
I ran the command below and seeing an error that -x option is not supported:
node:~/anu/full_build/chameleon-plugin$ time /usr/bin/ccache -x c++ --std c++17 -v -dM -E - < /dev/null
/usr/bin/ccache: invalid option -- 'x'
Usage:
ccache [options]
ccache compiler [compiler options]
compiler [compiler options] (via symbolic link)
Common options:
-c, --cleanup delete old files and recalculate size counters
(normally not needed as this is done
automatically)
-C, --clear clear the cache completely (except configuration)
-F, --max-files=N set maximum number of files in cache to N (use 0
for no limit)
-M, --max-size=SIZE set maximum size of cache to SIZE (use 0 for no
limit); available suffixes: k, M, G, T (decimal)
and Ki, Mi, Gi, Ti (binary); default suffix: G
-p, --show-config show current configuration options in
human-readable format
-s, --show-stats show summary of configuration and statistics
counters in human-readable format
-z, --zero-stats zero statistics counters
-h, --help print this help text
-V, --version print version and copyright information
Options for scripting or debugging:
--dump-manifest=PATH dump manifest file at PATH in text format
-k, --get-config=K print the value of configuration key K
--hash-file=PATH print the hash (<MD4>-<size>) of the file at PATH
--print-stats print statistics counter IDs and corresponding
values in machine-parsable format
-o, --set-config=K=V set configuration item K to value V
See also <https://ccache.dev>.
real 0m0.002s
user 0m0.000s
sys 0m0.002s