We are running SonarQube analysis via jenkins setup and observed a issue :WARN: Invalid probe found, skip analysis of files:

We have requirement to integrate jenkins with SonarQube server developer edition and activated with license keys. While running sonarqube analysis from jenkins we are observing an issues
WARN: Invalid probe found, skip analysis of files: [/path_to_file/testqueries.cc]
The compiler probe ‘stdout’ is expected to contain at least one ‘#define’ directive:
anyone have an idea about this issue?

Hello @v-jay,

We would need to have the following to understand your issue:

  • The scanner log, in verbose mode
  • The build-wrapper.log and build-wrapper-dump.json files

If you think these files contain private information, let us know, we’ll send you a private message that will allow you to send it privately.

Hello @JolyLoic ,
Thank you for the response and you are right the logs have private details .Please send me the private message or let me know how can i contact you. Thank you.

Hello @v-jay,

I took a look at the log files you sent me:

  • build-wrapper.log tells us that when you build your code, you are using a compiler in the path: /opt/rh/devtoolset-7/root/usr/bin/c++
  • During the analysis, we are trying to run this compiler to probe its configuration, but we can’t find it. Without configuration, we skip the files.

To me, it looks like the environment you try to analyze your code on is too different from the environment where you did the build.

As we say in the documentation:

The Build Wrapper collects information about the build including absolute file paths (source files, standard headers, libraries, etc…). Later on, SonarScanner uses this information and needs to access those paths. Whereas this is straightforward while running these 2 steps on the same host, it is worth some consideration when using any sort of containerization.

Hope this helps!

Hello @JolyLoic ,
Thank you for the details and your points really have lot of details and helped me to get idea on the sonarqube analysis process.
The issue may be in our configuration .

  • Sonarqube installed in one of the Ubuntu machine , and we are running all the analysis on the machine via Jenkins.

  • But the codes are building in a centsos7 container in the same machine and I am mounting the paths like Jenkins workspace and build-wrapper path.

  • Important point is : as i mentioned above configuration and comparing your points what i could see is the compiler “/opt/rh/devtoolset-7/root/usr/bin/c++” is in container but does not exist in the Ubuntu VM (where we have installed sonarqube server).

  • Could you please provide some any kind of help like how i can have this container built code to analyze by sonarqube server which is configured in ubuntu host.

Thank you,

Hello @v-jay,

There are three machines here:

  1. The machine with the SQ server (in your case, the ubuntu machine)
  2. The machine where the build is done with build wrapper (in your case, the centos container)
  3. The machine where the analysis is run, currently the same as the first one, if I understand correctly

We need 2 and 3 to be very similar, and in fact advise that they should be the same. However, 1 can be totally different for 2 & 3 (and it most cases, it should be. It’s a centralized server that can process the analysis coming from many different machines).

So in your case, the most simple is probably to run the scanner directly from within the centos container (it will need to be able to communicate with the server to send the results, which might require modifying the container configuration).

Hope this helps!

@JolyLoic ,
Thank you for the help and for helping me to debug the issue.
I have considered the points you mentioned and setup the environment . i mounted paths like scanner path, wrapper path from host to container and worked fine. very much appreciate your help

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.