CFamily, crash with CMake

I’m using SonarQube Developer Edition 8.3.1 on a Windows machine

I tried to build the attached HelloSonarCPP on the mac and windows - in both cases the same error:

13:01:00.301 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:
  * you are using the latest version of the build-wrapper and the CFamily analyzer
  * you are correctly invoking the scanner with correct configuration
  * your compiler is supported
  * you are wrapping your build correctly
  * you are wrapping a full/clean build
  * you are providing the path to the correct build-wrapper output directory
  * you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps
        at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:385)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)

What I did on windows:

clone repo and cd into repo
C:\software\cygwin\bin\cmake CMakeLists.txt
./ci/build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir  build_wrapper_output_directory C:\software\cygwin\bin\make -C ./ clean all
sonar-scanner -X

what I did on mac

clone repo and cd into repo
cmake CMakeLists.txt
./ci/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir  build_wrapper_output_directory make -C ./ clean all
sonar-scanner -X

Attached is the repo and the build_wrapper_output_directory ()

build_wrapper_output_directory.mac.zip (15.9 KB) hellosonarcpp-master.zip (1.6 MB)

Hi @RalfBalaszeskul-EH,

in your sonar-project.properties file:

# path to source directories (required)
sonar.sources=./hellosonar.cpp

you are giving the path to a file, the documentation and the comment explicitly mention path to source directories. Could you please adjust that?

I did it, but I have the same problem.
On mac, I did the last step (sonar-scanner -X) on a Windows-machine (because of VPN access). I think, that is the reason on the mac side. Right?

On windows, I use cygwin … here is the output: build_wrapper_output_directory.zip (15.6 KB)
I think it is the same reason like Cygwin, cfamily, wrapper -> crash in 'sonar-scanner'

Hi @RalfBalaszeskul-EH,

without sonar-scanner output and build-wrapper content it is difficult to say.

yes, same cygwin problem.

Here is the whole zipfile: hellosonarcpp.zip (2.6 MB)

Id did

MacOSX: clone repo and cd into repo
MacOSX: cmake CMakeLists.txt
MacOSX: ./ci/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir  build_wrapper_output_directory make -C ./ clean all
Win10: sonar-scanner -X

Hi @RalfBalaszeskul-EH,

I didn’t find the sonar-scanner output log.

So I tried with MinGW - scan now works!! Thanks a lot! I did the following:

Adding CMake and MinGW to the Path, then

cmake -G "MinGW Makefiles" CMakeLists.txt
 ./build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir  build_wrapper_output_directory C:\software\MinGW\bin\mingw32-make.exe -C ./ clean all

I didn’t find the sonar-scanner output log.

Where can I find the sonar-scanner output log?

Hi @RalfBalaszeskul-EH,

good to hear, MinGW preserves paths Windows style. Did you also change compiler?

The sonar-scanner output log is the standard output/error printed by the sonar-scanner, it would be nice if you could share it running an analysis with sonar.verbose=true property.

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