Please provide
- Operating system: Windows 10 Enterprise 19045.4529
- SonarLint plugin version: 10.7.0.78874
- Programming language you’re coding in: C++
- Is connected mode used: problem exists in connected and unconnected mode as well
- Connected to SonarCloud or SonarQube (and which version): SonarQube
And a thorough description of the problem / question:
We are using the docker toolchain inside CLion for C++ development: CLion docs.
The docker image is based on ubuntu:24.04.
Toolchain is set up correctly, build, run, debug all work.
Problem:
SonarLint analysis doesn’t work, neither in connected, or unconnected mode.
When triggering an analysis for a file, it looks like it completes fine, no errors are produced, but no issues are displayed, even if there are issues.
Possible reason:
In the SonarLint log I can see that SonarLint is trying to run “C:\usr\bin\c++”.
This fails as the host doesn’t have a c++ compiler at this location.
SonarLint should run the compiler inside the docker container instead.
Possibly related issue: https://community.sonarsource.com/t/how-to-use-sonarlint-with-clion-and-docker-toolchain/81395
Full log:
Analysing 'main.cpp' (ID cfda9b39-d48e-4222-a712-6870f2af7e23)...
[2024-07-25T10:08:20.542] [SonarLint Server RPC request executor] INFO sonarlint - Triggering analysis with configuration: [
baseDir: C:\projects\xxxxxxxxx\int
extraProperties: {sonar.cfamily.build-wrapper-content={"version":0,"captures":[{"compiler":"clang","cwd":"C:\\projects\\xxxxxxxxx\\int\\src\\cmake-build-debug\\.","executable":"C:\\usr\\bin\\c++","properties":{"sonarLanguage":"cpp"},"cmd":["C:\\usr\\bin\\c++","C:/projects/xxxxxxxxx/int/src/main.cpp","-g","-fdiagnostics-color=always"]}]}}
activeRules: [c:S2757, cpp:S1862, c:S2755, c:S2754, cpp:S872, cpp:S1854, c:S2761, cpp:S877, cpp:S878, cpp:S876, c:S859, c:S1656, cpp:S1871, c:S1659, cpp:S3806, cpp:S3805, c:S860, c:S2753, cpp:S886, cpp:S3807, c:S836, c:S833, cpp:S859, cpp:S860, c:S841, c:S3807, cpp:S2753, c:S3806, c:S3805, cpp:S1659, cpp:S1656, c:S1871, c:S897, c:S1854, cpp:S2761, cpp:S3608, cpp:S1669, cpp:S2757, c:S1862, cpp:S2754, cpp:S2755, cpp:S3609, c:S872, cpp:S1874, c:S878, c:S876, cpp:S897, c:S1874, cpp:S2738, cpp:S2737, c:S886, cpp:S6234, cpp:S6236, secrets:S6334, cpp:S5381, c:S3689, secrets:S6335, secrets:S6336, cpp:S6230, secrets:S6337, cpp:S6231, secrets:S6338, cpp:S6232, c:S1036, c:S3457, c:S2123, cpp:S6003, cpp:S6487, cpp:S6004, cpp:S6488, cpp:S6005, cpp:S6489, cpp:S6006, cpp:S6008, cpp:S6009, cpp:S6482, cpp:S6483, cpp:S6000, cpp:S6484, c:S1264, c:S3687, cpp:S2095, cpp:S6214, cpp:S6456, cpp:S6458, cpp:S6459, c:S3231, cpp:S6222, cpp:S6223, cpp:S6225, cpp:S6226, cpp:S6228, cpp:S6229, c:S3458, cpp:S6460, cpp:S6461, cpp:S6462, cpp:S5180, c:S3646, cpp:S6030, cpp:S5184, cpp:S6031, cpp:S6032, cpp:S6033, c:S5825, c:S5832, c:S2323, cpp:S833, cpp:S836, cpp:S6045, c:S1219, cpp:S1820{maximumFieldThreshold=20}, cpp:S841, cpp:S6013, cpp:S6015, cpp:S6016, cpp:S6017, cpp:S6018, cpp:S6490, cpp:S6491, cpp:S6492, cpp:S6493, cpp:S6010, cpp:S6494, cpp:S6011, cpp:S6495, c:S5847, cpp:S6012, c:S2583, c:S4524, cpp:S814, cpp:S6024, cpp:S6025, cpp:S6026, cpp:S6029, cpp:S817, cpp:S818, c:S1479{maximum=30}, cpp:S6020, cpp:S6021, cpp:S6022, cpp:S6023, c:S1481, cpp:S824, cpp:S5421, cpp:S5425, cpp:S2156, cpp:S1068, secrets:S6731, cpp:S1065, secrets:S6732, cpp:S1066, secrets:S6733, c:S4143, cpp:S5416, cpp:S5658, cpp:S5417, cpp:S3491, cpp:S3490, cpp:S1079, secrets:S6720, secrets:S6721, secrets:S6722, secrets:S6723, cpp:S3252, secrets:S6717, secrets:S6718, secrets:S6719, c:S2190, c:S2193, cpp:S5404, cpp:S3468, cpp:S1048, secrets:S6751, cpp:S1045, secrets:S6752, cpp:S1046, secrets:S6753, cpp:S1044, secrets:S6755, cpp:S1042, c:S5259, cpp:S1039, cpp:S3458, c:S5494, c:S5491, cpp:S3471, cpp:S3470, cpp:S5414, cpp:S5415, cpp:S2387, cpp:S3231, cpp:S3230, c:S5489, secrets:S6736, secrets:S6739, c:S5485, cpp:S3229, c:S5486, c:S5487, c:S5488, cpp:S5408, c:S5000, cpp:S5409, cpp:S2193, cpp:S2190, secrets:S6771, secrets:S6773, secrets:S6777, secrets:S6769, c:S1079, c:S3491, secrets:S6760, secrets:S6762, secrets:S6764, c:S5658, secrets:S6765, cpp:S4144, cpp:S4143, secrets:S6768, c:S1065, secrets:S6758, c:S1066, cpp:S3261, cpp:S1081, cpp:S5205, cpp:S5213, secrets:S6782, secrets:S6783, c:S1081, cpp:S5820, cpp:S3642, cpp:S110{max=5}, cpp:S112, cpp:S1219, cpp:S2305, cpp:S3636, cpp:S2303, cpp:S1699, cpp:S5812, cpp:S5817, cpp:S5832, cpp:S2323, cpp:S3654, cpp:S1235, cpp:S1232, cpp:S1231, cpp:S3646, cpp:S5825, cpp:S125, cpp:S5827, cpp:S128, secrets:S6910, cpp:S1679, cpp:S4962, cpp:S3630, cpp:S3628, cpp:S1448{maximumMethodThreshold=35}, cpp:S3624, cpp:S107{max=7}, cpp:S108, c:S1905, c:S1909, cpp:S3687, cpp:S1265, cpp:S3685, cpp:S1264, cpp:S2107, c:S5276, cpp:S1016, c:S5278, cpp:S1017, c:S5279, c:S935, c:S5273, c:S5270, c:S5271, cpp:S3691, c:S936, cpp:S1036, cpp:S3457, cpp:S2123, cpp:S1035, cpp:S3692, c:S5266, c:S5267, cpp:S3689, c:S5261, c:S946, c:S5262, c:S5263, c:S905, cpp:S4997, cpp:S1003, secrets:S6710, cpp:S1000, cpp:S1242, cpp:S1481, secrets:S6713, secrets:S6703, secrets:S6704, cpp:S134{max=3}, secrets:S6705, secrets:S6706, cpp:S1238, cpp:S3659, secrets:S6708, cpp:S3657, cpp:S1236, cpp:S1479{maximum=30}, cpp:S3656, c:S912, c:S5297, c:S5293, c:S1916, c:S916, cpp:S4524, cpp:S3432, cpp:S2583, c:S1913, cpp:S1011, secrets:S6700, c:S1911, secrets:S6701, c:S1912{nonReentrantFunctionList=::asctime,::crypt,::ctermid,::ctime,::fgetgrent,::fgetpwent,::fgetspent,::getgrent,::getgrgid,::getgrnam,::gethostbyaddr,::gethostbyname,::gethostbyname2,::gethostent,::getlogin,::getnetbyaddr,::getnetbyname,::getnetent,::getnetgrent,::getprotobyname,::getprotobynumber,::getprotoent,::getpwent,::getpwnam,::getpwuid,::getrpcbyname,::getrpcbynumber,::getrpcent,::getservbyname,::getservbyport,::getservent,::getspent,::getspnam,::gmtime,::localtime,::sgetspent,::strtok,::ttyname}, secrets:S6702, cpp:S4999, cpp:S1006, cpp:S4998, c:S924{maxNumberOfTerminationStatements=1}, c:S5283, c:S923, cpp:S5847, c:S5280, c:S5281, secrets:S6292, c:S969, cpp:S6194{maximumCoroutineCognitiveComplexityThreshold=25}, cpp:S6195, c:S3729, cpp:S6197, c:S3728, c:S2637, c:S3973, cpp:S6190, c:S3730, c:S3972, cpp:S6191, cpp:S998, cpp:S999, c:S977, cpp:S995, secrets:S6290, cpp:S1751, cpp:S1990, cpp:S3923, c:S1301, cpp:S6178, cpp:S6179, cpp:S969, cpp:S6171, cpp:S6172, c:S3744, cpp:S6177, c:S2665, cpp:S977, c:S956, c:S955, c:S954, cpp:S2808, cpp:S2807, cpp:S6189, c:S959, cpp:S6181, cpp:S6185, cpp:S6186, cpp:S6187, cpp:S6188, cpp:S2815, cpp:S2813, cpp:S6180, c:S961, c:S3923, cpp:S1301, c:S1751, cpp:S796, cpp:S797, cpp:S798, cpp:S3732, cpp:S3731, cpp:S3973, cpp:S3730, cpp:S3972, cpp:S3729, cpp:S3728, cpp:S2637, cpp:S3726, cpp:S1762, cpp:S1763, c:S1767, cpp:S1760, c:S1764, cpp:S1761, c:S3949, c:S1768, cpp:S3936, cpp:S3935, c:S999, c:S995, c:S3936, c:S3935, cpp:S3949, cpp:S1768, c:S1762, cpp:S1767, c:S1763, cpp:S1764, c:S1760, c:S1761, cpp:S3708, cpp:S5265, cpp:S5266, cpp:S5025, cpp:S5267, secrets:S6690, cpp:S5269, secrets:S6691, cpp:S5028, secrets:S6692, cpp:S905, secrets:S6693, secrets:S6694, secrets:S6695, secrets:S6696, secrets:S6697, c:S2479, secrets:S6698, cpp:S5261, secrets:S6699, cpp:S5020, cpp:S5262, cpp:S5263, cpp:S6352, c:S4423, cpp:S912, cpp:S5276, cpp:S6365, cpp:S5277, cpp:S6366, cpp:S919, cpp:S5278, cpp:S6367, cpp:S5279, cpp:S6369, cpp:S916, secrets:S6684, cpp:S5270, secrets:S6686, cpp:S5271, secrets:S6687, cpp:S5272, secrets:S6688, cpp:S5273, c:S5978, secrets:S6689, cpp:S5274, cpp:S5275, c:S3562, c:S5501, c:S1144, c:S2234, cpp:S923, c:S108, cpp:S1909, cpp:S924{maxNumberOfTerminationStatements=1}, c:S107{max=7}, cpp:S1905, cpp:S5485, cpp:S5486, cpp:S5487, cpp:S5488, cpp:S5489, cpp:S5008, c:S2259, cpp:S5000, c:S3358, c:S798, c:S1172, c:S797, c:S3590, c:S796, cpp:S5259, cpp:S5018, cpp:S5019, cpp:S5491, c:S4426, cpp:S5494, cpp:S5495, c:S3584, c:S3588, cpp:S6391, c:S3529, c:S134{max=3}, c:S1110, c:S2681, c:S3776{maximumFunctionCognitiveComplexityThreshold=25}, cpp:S954, cpp:S955, cpp:S956, cpp:S6168, cpp:S6169, cpp:S959, c:S2668, cpp:S6164, c:S3519, cpp:S6165, c:S3518, c:S1103, c:S3520, cpp:S961, cpp:S1709, cpp:S5280, cpp:S5281, c:S2216, cpp:S5283, cpp:S6372, cpp:S1913, cpp:S1911, cpp:S1912{nonReentrantFunctionList=::asctime,::crypt,::ctermid,::ctime,::fgetgrent,::fgetpwent,::fgetspent,::getgrent,::getgrgid,::getgrnam,::gethostbyaddr,::gethostbyname,::gethostbyname2,::gethostent,::getlogin,::getnetbyaddr,::getnetbyname,::getnetent,::getnetgrent,::getprotobyname,::getprotobynumber,::getprotoent,::getpwent,::getpwnam,::getpwuid,::getrpcbyname,::getrpcbynumber,::getrpcent,::getservbyname,::getservbyport,::getservent,::getspent,::getspnam,::gmtime,::localtime,::sgetspent,::strtok,::ttyname}, c:S1135, c:S1133, c:S1134, cpp:S935, cpp:S1916, cpp:S6147, cpp:S936, c:S1117, cpp:S5293, c:S1116, c:S5955, cpp:S5297, c:S1121, c:S1123, cpp:S946, c:S128, c:S125, cpp:S5782, cpp:S6872, cpp:S5542, cpp:S1181, cpp:S5302, cpp:S5547, cpp:S6636, cpp:S1188{max=20}, cpp:S2275, cpp:S1186, cpp:S1185, c:S6200, c:S5350, c:S4263, cpp:S5553, cpp:S5314, cpp:S5798, cpp:S1199, cpp:S3135, cpp:S5308, cpp:S5524, cpp:S3588, cpp:S3584, cpp:S4426, cpp:S5999, cpp:S1172, cpp:S3590, cpp:S6621, cpp:S3358, cpp:S2259, c:S2095, c:S5308, c:S1198, c:S5314, c:S5798, c:S1199, c:S3135, cpp:S4263, cpp:S6200, cpp:S5350, c:S1186, c:S2275, c:S5547, c:S5782, c:S5542, cpp:S5566, cpp:S6655, c:S5570, cpp:S6427, cpp:S5570, c:S6655, cpp:S3522, cpp:S1103, cpp:S3520, c:S1820{maximumFieldThreshold=20}, cpp:S3519, cpp:S3518, cpp:S2668, cpp:S5950, cpp:S5951, cpp:S5952, cpp:S5954, cpp:S3776{maximumFunctionCognitiveComplexityThreshold=25}, cpp:S1110, cpp:S2681, cpp:S3529, cpp:S5945, cpp:S3743, cpp:S5912, cpp:S2665, c:S1831, c:S1836, cpp:S3744, cpp:S5500, cpp:S5501, cpp:S5502, cpp:S1144, cpp:S2234, cpp:S3562, cpp:S1141, c:S814, cpp:S5978, c:S819, cpp:S5995, c:S818, c:S817, cpp:S5997, cpp:S2486, cpp:S1155, cpp:S3576, cpp:S4423, cpp:S3574, cpp:S2479, c:S824, cpp:S5506, cpp:S5507, c:S820, c:S5381, cpp:S5962, cpp:S5964, cpp:S5965, cpp:S3543, cpp:S1123, cpp:S3541, cpp:S1121, cpp:S3539, cpp:S2209, cpp:S1117, cpp:S1116, cpp:S5955, cpp:S5972, cpp:S1135, cpp:S1133, cpp:S1134, cpp:S3548, cpp:S2216]
inputFiles: [
file:///C:/projects/xxxxxxxxx/int/src/main.cpp (UTF-8)
]
]
[2024-07-25T10:08:20.542] [SonarLint Server RPC request executor] INFO sonarlint - Git Repository not found for int. The path C:\projects\xxxxxxxxx\int is not in a Git repository
[2024-07-25T10:08:20.597] [sonarlint-analysis-engine] INFO sonarlint - Index files
[2024-07-25T10:08:20.597] [Report about progress of file indexation] INFO sonarlint - 1 file indexed
[2024-07-25T10:08:20.685] [sonarlint-analysis-engine] ERROR sonarlint - Error executing sensor: 'CFamily'
java.lang.IllegalStateException: java.io.IOException: Cannot run program "C:\usr\bin\c++" (in directory "C:\projects\xxxxxxxxx\int\src\cmake-build-debug\."): CreateProcess error=2, The system cannot find the file specified
at com.sonar.cpp.driver.ProcessExecutor.execute(ProcessExecutor.java:73)
at com.sonar.cpp.driver.ProcessExecutor.execute(ProcessExecutor.java:44)
at com.sonar.cpp.analyzer.ClangDriver.runCompiler(ClangDriver.java:914)
at com.sonar.cpp.analyzer.ClangDriver.lambda$probeCompiler$12(ClangDriver.java:984)
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)
at com.sonar.cpp.analyzer.ClangDriver.probeCompiler(ClangDriver.java:984)
at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:604)
at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:47)
at com.sonar.cpp.plugin.SonarLintSensor.lambda$processBuildWrapper$2(SonarLintSensor.java:283)
at com.sonar.cpp.plugin.BuildWrapperJsonReader.readCaptures(BuildWrapperJsonReader.java:100)
at com.sonar.cpp.plugin.SonarLintSensor.processBuildWrapper(SonarLintSensor.java:282)
at com.sonar.cpp.plugin.SonarLintSensor.process(SonarLintSensor.java:135)
at com.sonar.cpp.plugin.SonarLintSensor.execute(SonarLintSensor.java:97)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:165)
at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:95)
at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensors(SensorsExecutor.java:86)
at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:77)
at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.startComponents(SpringComponentContainer.java:182)
at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.execute(SpringComponentContainer.java:161)
at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.doRunAnalysis(AnalyzeCommand.java:65)
at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.lambda$execute$0(AnalyzeCommand.java:54)
at org.sonarsource.sonarlint.core.progress.RpcProgressMonitor.lambda$startTask$0(RpcProgressMonitor.java:44)
at org.sonarsource.sonarlint.core.progress.TaskManager.startTask(TaskManager.java:61)
at org.sonarsource.sonarlint.core.progress.RpcProgressMonitor.startTask(RpcProgressMonitor.java:44)
at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:53)
at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:34)
at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:153)
at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:71)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.io.IOException: Cannot run program "C:\usr\bin\c++" (in directory "C:\projects\xxxxxxxxx\int\src\cmake-build-debug\."): CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
at com.sonar.cpp.driver.ProcessExecutor.execute(ProcessExecutor.java:57)
... 30 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
... 32 more
[2024-07-25T10:08:20.686] [sonarlint-analysis-engine] INFO sonarlint - Available processors: 8
[2024-07-25T10:08:20.686] [sonarlint-analysis-engine] INFO sonarlint - Using 8 threads for analysis.
[2024-07-25T10:08:20.823] [sonarlint-analysis-engine] INFO sonarlint - The property "sonar.tests" is not set. To improve the analysis accuracy, we categorize a file as a test file if any of the following is true:
* The filename starts with "test"
* The filename contains "test." or "tests."
* Any directory in the file path is named: "doc", "docs", "test" or "tests"
* Any directory in the file path has a name ending in "test" or "tests"
[2024-07-25T10:08:20.833] [sonarlint-analysis-engine] INFO sonarlint - Analyzing all except non binary files
[2024-07-25T10:08:20.833] [Progress of the text and secrets analysis] INFO sonarlint - 1 source file to be analyzed
[2024-07-25T10:08:20.874] [Progress of the text and secrets analysis] INFO sonarlint - 1/1 source file has been analyzed
[2024-07-25T10:08:20.884] [sonarlint-analysis-engine] INFO sonarlint - Analysis detected 0 issues and 0 Security Hotspots in 623ms