VsCode: 1.72.2
Operating system: Ubuntu 18.04
Compiler: QNX 7.10
SonarLint plugin version:V3.11.0
Programming language you’re coding in: C and C++
Is connected mode used: SonarCloud
And a thorough description of the problem / question
I am using QNX 7.1 with vscode and SonarLint. I am seeing an error in the log - The QNX_HOST/QNX_TARGET environment variables must be set. To keep in sync with different build configurations, we use a script to set QNX_HOST/QNX_TARGET. This was maddening to figure out with the VSCode CMake extension but found that environmentSetupScript property allows me to do that.
I see in the log below the compiler settings are coming from the VSCode C++ extension.
I don’t see a way to set these environment variables so that SonarLint can get past this. Is this executing like a separate terminal instance?
{
“name”: “QNX 7.1”,
“environmentSetupScript”: “/home/test/bin/setupqnx”,
“compilers”: {
“C”: “/home/test/qnx710/host/linux/x86_64/usr/bin/q++”,
“CXX”: “/home/test/qnx710/host/linux/x86_64/usr/bin/q++”
}
LOG Details
[Debug - 10:41:02.465] Start analysis
[Info - 10:41:02.482] Index files
[Debug - 10:41:02.491] Language of file ‘file:///home/test/src/container/build/src/boxer.cpp’ is set to ‘C++’
[Info - 10:41:02.503] 1 file indexed
[Debug - 10:41:02.627] ‘JavaSensor’ skipped because there is no related files in the current project
[Debug - 10:41:02.627] ‘Python Sensor’ skipped because there is no related files in the current project
[Debug - 10:41:02.627] Execute Sensor: HTML
[Debug - 10:41:02.627] ‘XML Sensor’ skipped because there is no related files in the current project
[Debug - 10:41:02.627] ‘PHP sensor’ skipped because there is no related files in the current project
[Debug - 10:41:02.627] ‘Analyzer for “php.ini” files’ skipped because there is no related files in the current project
[Debug - 10:41:02.627] Execute Sensor: Sonar Secrets Detection Sensor
[Debug - 10:41:02.663] Execute Sensor: CFamily
[Debug - 10:41:02.690] Cached compilation database modified time did not change
[Debug - 10:41:02.690] Time to parse Compilation Database: 0ms
[Debug - 10:41:02.690] Probing compiler: [/home/test/qnx710/host/linux/x86_64/usr/bin/q++, -Vgcc_ntox86_64, -lang-c++, -std=gnu++17, -vv, -E, -Wp,-dM, -]
[Debug - 10:41:02.974] stdout:
[Debug - 10:41:02.975] stderr:
cc: The QNX_HOST/QNX_TARGET environment variables must be set
[Error - 10:41:02.975] Error executing sensor: ‘CFamily’
[Error - 10:41:02.975] java.lang.NullPointerException: Cannot invoke “String.equals(Object)” because “std” is null
at com.sonar.cpp.analyzer.StdFlags.fromCppMacrosWithoutConditionalFeatures(StdFlags.java:34)
at com.sonar.cpp.analyzer.QccDriver.onCapture(QccDriver.java:173)
at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:35)
at com.sonar.cpp.plugin.SonarLintSensor.lambda$processCompileCommands$1(SonarLintSensor.java:152)
at java.base/java.util.HashMap.forEach(Unknown Source)
at com.sonar.cpp.plugin.SonarLintSensor.processCompileCommands(SonarLintSensor.java:146)
at com.sonar.cpp.plugin.SonarLintSensor.process(SonarLintSensor.java:132)
at com.sonar.cpp.plugin.SonarLintSensor.execute(SonarLintSensor.java:95)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:193)
at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:75)