C++ SonarScanner "Cannot run program"

I’m using SonarScanner CLI 5.0.1 to scan C++ for code quality.

I have passed it following parameters:

-Dsonar.projectBaseDir=/path/to/myproject/ 
-Dsonar.cfamily.compile-commands=.builddir/.builddir-test-unit-coverage/compile_commands.json

When I run the scanner, I get following output:

08:44:15.046 INFO: Sensor CFamily [cpp]
08:44:15.091 INFO: CFamily plugin version: 6.53.0.67215
08:44:15.091 INFO: Using compile commands: /path/to/myproject/.builddir/.builddir-test-unit-coverage/compile_commands.json
08:44:15.093 INFO: Available processors: 16
08:44:15.096 INFO: Using 16 threads for analysis.
08:44:15.110 DEBUG: Total system memory: 66753867776
08:44:15.111 DEBUG: Unpacking analyzer to: /path/to/myproject/.scannerwork/.sonartmp/3595757717881679662
...
08:44:19.462 INFO: Loading cache from: server
08:44:19.463 INFO: Existing cache invalidated and deleted, change detected in quality profile
08:44:19.483 DEBUG: Probing compiler: [/usr/bin/c++, -x, c++, --std, gnu++17, -v, -dM, -E, -]
08:44:19.644 INFO: ------------------------------------------------------------------------
08:44:19.644 INFO: EXECUTION FAILURE
08:44:19.644 INFO: ------------------------------------------------------------------------
08:44:19.644 INFO: Total time: 1:00.731s
08:44:19.674 INFO: Final Memory: 23M/216M
08:44:19.674 INFO: ------------------------------------------------------------------------
08:44:19.674 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: java.io.IOException: Cannot run program "/path/to/myproject/.scannerwork/.sonartmp/3595757717881679662/subprocess" (in directory "/path/to/myproject/.builddir/.builddir-test-unit-coverage"): error=2, No such file or directory
        at com.sonar.cpp.driver.ProcessExecutor.execute(ProcessExecutor.java:73)
...
08:44:19.675 ERROR: 
08:44:19.675 ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

I can confirm that /path/to/myproject/.builddir/.builddir-test-unit-coverage is present and folder and its contents have read permissions for all users.

Any idea what might be causing this?

Hi @Ivan_Ribakov,

This error can mean two things, either:

  • This directory /path/to/myproject/.builddir/.builddir-test-unit-coverage doesn’t exist during the analysis.
  • the other possibility, is that you are on unsupported OS/arch. Are you using Alpine Linux? ARM64? 32-bit arch?

Thanks,

@Ivan_Ribakov, any update?

Sorry, I was unable to reproduce after getting back to this after a while.

1 Like