java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-

Hi
Update:

we have a project that we manage to scan and push to sonar succussfully with sonar scanner (see Sonar GUI screenshot)

the project strucure is:

               root
                     src
               
                     out
                            blackwell
                     debug

                            coverity

BUT
we want to exclude the “out” and “debug” folders which are the project build output and only to include the “src” folder
so we tried to configure:

sonar.sources=src/
or
to exclude the out and debug folders

in both cases when trying to narrow the scope only to src, the scanner failed with the error :
ERROR: Error during SonarScanner execution
12:27:50 java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:
12:27:50 * you are using the latest version of the build-wrapper and the CFamily analyzer
12:27:50 * you are correctly invoking the scanner with correct configuration
12:27:50 * your compiler is supported
12:27:50 * you are wrapping your build correctly
12:27:50 * you are wrapping a full/clean build
12:27:50 * you are providing the path to the correct build-wrapper output directory
12:27:50 * you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps…

facts:
Sonarcube version: 10.5.1
analyzer version 6.54.0.69031
build-wrapper version 6.52.1
running on docker (same for build and analysis)

Hi,

Can you share your analysis configuration? Specifically, I’m wondering what sonar.sources is set too.

 
Thx,
Ann

Hi @Dudi_Avraham, and thanks for sharing the problem with us,

Note that we strongly recommend using a matching version of build-wrapper and the analyzer. Build-wrapper should be downloaded from your SQ instance. Out of curiosity, are you encountering problems when using the matching build-wrapper version?

Are there any C/C++/Objective-C files that reside out of src/ and are part of the build? If so, then it is possible that the analysis is ending successfully because those files are being analyzed (and the files under src/ are not actually analyzed). The logs should list the name of each translation unit that was analyzed along with a summary in the end “X compilation units were fully analyzed”. I would suggest checking the logs when you use **/*.c, are the files from the src/ directory actually analyzed?

To help us understand the problem, could you please share your full debug scanner logs with us (by setting the property sonar.verbose=true) and files from your build-wrapper output directory?

I can open a private thread with you if you prefer to share these files in private.

Best regards,
Michael

thank you

i have updated the ticket.
i found that the problem is when trying to exclude some out& debug folders

Hi @Dudi_Avraham, and thanks for sharing the additional information.

The paths to compiled files captured in the build-wrapper-dump.json need to match indexed files by the scanner in the src directory. Do you have commands in your build-wrapper-dump.json file that are processing files in the src/ directory?

In order to accurately identify the problem, and suggest more relevant solutions, I would still need to examine the verbose analysis scanner logs and the build-wrapper output directory.

I can also create a private thread with you if you prefer to share this information privately.

Best regards,
Michael

Hi Michael
Thanks
please do create a private thread and I will share the verbose scanner logs

the out the debug folders are indeed folder that are created during the build-wrapper proccess

and please note that the problematic folders “debug” and “out” are an output of the build process itself.

Hi @Dudi_Avraham, and thanks again for sharing the problem with us,

I sent a private message to get the logs about a week ago. Please let me know if you are having problems accessing the thread…

Best regards,
Michael

1 Like