Hi,
We are using sonarqube for our code analysis.
Below are the pipeline steps followed
- mkdir $HOME/.sonar
- curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip
- unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make clean all
- pipe: sonarsource/sonarqube-scan:1.0.0
variables:
EXTRA_ARGS: -Dsonar.cfamily.build-wrapper-output=bw-output -X
SONAR_HOST_URL: ${SONAR_HOST_URL}
SONAR_TOKEN: ${SONAR_TOKEN}
13:12:28.720 DEBUG: Using build-wrapper-dump.json probe
13:12:28.720 WARN: Invalid probe found, skip analysis of files: [/opt/atlassian/pipelines/agent/build/src/logging/logger.cpp]
The compiler probe 'stdout' is expected to contain at least one '#define' directive:
13:12:28.722 INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 0 (forceInclude=0,throughHeader=0)
13:12:28.722 INFO: SE: 0 out of 0
13:12:28.722 INFO: Z3 refutation rate: 0 out of 0
13:12:28.723 INFO: Subprocess(es) done in 67ms
13:12:28.724 INFO: 0 compilation units analyzed
13:12:28.760 INFO: ------------------------------------------------------------------------
13:12:28.760 INFO: EXECUTION FAILURE
13:12:28.760 INFO: ------------------------------------------------------------------------
13:12:28.761 INFO: Total time: 1:01.027s
13:12:28.865 INFO: Final Memory: 27M/97M
13:12:28.866 INFO: ------------------------------------------------------------------------
13:12:28.866 ERROR: Error during SonarScanner 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.process(CFamilySensor.java:481)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:178)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:79)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:382)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:378)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:347)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:136)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
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(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Makefile
#
# makefile to build the agent application
#
#
# compiler
#
CC = g++
#
# Sources, Dependencies, Libs, Includes
#
TARGET_EXEC = agent
SRC_DIRS = ./src
SRCS = $(shell find $(SRC_DIRS) -name *.cpp)
DEPS = $(OBJS:.o=.d)
LIBS = -l:libboost_log_setup.a -l:libboost_log.a -l:libboost_regex.a -l:libboost_filesystem.a -l:libboost_thread.a -l:libssl.a -l:libcrypto.a -l:libstdc++.a -l:libz.a -ldl -lpthread
INC_DIRS = $(shell find $(SRC_DIRS) -type d)
INC_FLAGS = $(addprefix -I,$(INC_DIRS))
CPPFLAGS = $(INC_FLAGS) -MMD -MP
MKDIR_P = mkdir -p
STATIC_BUILD_ENABLE = -DSTATIC_BUILD_ENABLE=1
#
# Debug build settings
#
BUILD_DEBUG_DIR = ./debug
OBJS_DEBUG = $(SRCS:%=$(BUILD_DEBUG_DIR)/%.o)
RELCFLAGS = -O3 -Wall
APP_DEBUG_VERSION = $(or $(dversion),$(shell cat version | rev | cut -d"." -f2- | rev).$(shell git describe --all --long | cut -d "-" -f 3))
DEBUG_VERSION_INFO = -DAPP_VERSION=\"$(APP_DEBUG_VERSION)\"
OUT_DEBUG_DIR = $(BUILD_DEBUG_DIR)/$(APP_DEBUG_VERSION)
.PHONY: all clean debug
all: clean debug
#
# Debug rules
#
debug: $(OUT_DEBUG_DIR)/$(TARGET_EXEC)
$(OUT_DEBUG_DIR)/$(TARGET_EXEC): $(OBJS_DEBUG)
$(MKDIR_P) $(OUT_DEBUG_DIR)
$(CC) $(OBJS_DEBUG) $(LIBS) -o $@ $(LDFLAGS)
$(BUILD_DEBUG_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(DBGCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $(DEBUG_VERSION_INFO) $(STATIC_BUILD_ENABLE)
#
# Clean
#
clean:
$(RM) -r $(BUILD_DEBUG_DIR)
$(RM) -r $(BUILD_RELEASE_DIR)
Can someone please help. Thanks in advance.