SonarScanner C++ Symbolic Links

System Information:
SonarQube Scanner
Java 11.0.3 AdoptOpenJDK (64-bit)
Linux 5.3.0-40-generic amd64
build-wrapper, version 6.3 (linux-x86)
SonarQube 7.9 LTS

I’ve encountered an issue when attempting to make use of the SonarQube scanner for C++ code in conjunction with the Bullseye code coverage tool.

To reproduce

  • Makefile to build code using the Bullseye g++ compiler
    • This is a symbolic link to their own covc application, which just proxies through to the system g++ whilst generating coverage
  • Generate a coverage.xml using Bullseye covxml
  • Run the sonar build-wrapper on the same makefile target (And so uses the Bullseye g++ compiler)
  • Run sonar-scanner

What we get is the following from the sonar-scanner (However there are times in which this does not occur):

ERROR: Error during SonarQube Scanner execution
        at com.sonar.cpp.analyzer.StdFlags.fromCppMacros(
        at com.sonar.cpp.analyzer.ClangDriver.onCapture(
        at com.sonar.cpp.plugin.CFamilySensor.process(
        at com.sonar.cpp.plugin.CFamilySensor.execute(
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(
        at org.sonar.core.platform.ComponentContainer.startComponents(
        at org.sonar.core.platform.ComponentContainer.execute(
        at org.sonar.scanner.scan.ProjectScanContainer.scan(
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(
        at org.sonar.core.platform.ComponentContainer.startComponents(
        at org.sonar.core.platform.ComponentContainer.execute(
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(
        at org.sonar.core.platform.ComponentContainer.startComponents(
        at org.sonar.core.platform.ComponentContainer.execute(
        at org.sonar.batch.bootstrapper.Batch.doExecute(
        at org.sonar.batch.bootstrapper.Batch.execute(
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
        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(
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.main(
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Due to the fact our build makes use of the Bullseye g++ compiler, when making use of -X on the sonar-scanner it fails to run as Bullseye’s g++ will error when the -x is passed through to this.

Potential Workaround

It appears that if I remove the symbolic links, replacing them instead of hard links to the covc binary, the sonar-scanner function works as expected.

I assume that this means the issue is when making use of a symbolic link for your compiler, is this something that is known to cause issues?

Hi @56KBs,

this issue doesn’t seem to be related to symbolic links.

Could you please update the SonarCFamily analyzer and the build-wrapper to its latest version 6.7? Many bugs have been fixed in the mean time.