my gitlab build stage gets exited during make-phase with errorcode 1 because inaktive code (which is grayed out in the IDE but not in the .c/.h files uploaded to the repository).

As an example i want to point out the following errormessage:

Example errormessage

../gecko_sdk_4.2.2/platform/radio/rail_lib/chip/efr32/efr32xg2x/rail_chip_specific.h:610:2: error: #error "This config is not valid, RAIL_RF_PATHS has to be either 1 or 2"
  610 | #error "This config is not valid, RAIL_RF_PATHS has to be either 1 or 2"
      |  ^~~~~

In my IDE this specific segment of code is grayed out, which means it should be ignored. In IDE

How to fix all the issues, where do i have to make changes to my configuration.

My buildprocess errorlog:

$ build-wrapper/build-wrapper-linux-x86-64 --out-dir "${BUILD_WRAPPER_OUT_DIR}" make clean all
Making clean in ownSources
make[1]: Entering directory '/builds/root/honeyhtx02/ownSources'
test -z "sonar_scanner_example" || rm -f sonar_scanner_example
rm -f *.o
make[1]: Leaving directory '/builds/root/honeyhtx02/ownSources'
make[1]: Entering directory '/builds/root/honeyhtx02'
make[1]: Nothing to be done for 'clean-am'.
make[1]: Leaving directory '/builds/root/honeyhtx02'
Making all in ownSources
make[1]: Entering directory '/builds/root/honeyhtx02/ownSources'
gcc -DPACKAGE_NAME=\"sonar_scanner_example\" -DPACKAGE_TARNAME=\"sonar_scanner_example\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"sonar_scanner_example\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sonar_scanner_example\" -DVERSION=\"1.0\" -I.  -I../ownHeaders -I../gecko_sdk_4.2.2/platform/Device/SiliconLabs/EFR32ZG28/Include -I../gecko_sdk_4.2.2/platform/common/inc -I../gecko_sdk_4.2.2/platform/CMSIS/Core/Include -I../gecko_sdk_4.2.2/platform/service/device_init/inc -I../gecko_sdk_4.2.2/platform/emlib/inc -I../gecko_sdk_4.2.2/platform/service/hfxo_manager/inc -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_mbedtls_support/config -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_mbedtls_support/inc -I../gecko_sdk_4.2.2/util/third_party/mbedtls/include -I../gecko_sdk_4.2.2/util/third_party/mbedtls/library -I../gecko_sdk_4.2.2/platform/service/mpu/inc -I../gecko_sdk_4.2.2/platform/peripheral/inc -I../gecko_sdk_4.2.2/platform/service/power_manager/inc -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_psa_driver/inc/public -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_psa_driver/inc -I../gecko_sdk_4.2.2/platform/radio/rail_lib/common -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/ble -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/ieee802154 -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/zwave -I../gecko_sdk_4.2.2/platform/radio/rail_lib/chip/efr32/efr32xg2x -I../gecko_sdk_4.2.2/platform/radio/rail_lib/plugin/rail_util_callbacks -I../gecko_sdk_4.2.2/platform/radio/rail_lib/plugin/rail_util_protocol -I../gecko_sdk_4.2.2/platform/security/sl_component/se_manager/inc -I../gecko_sdk_4.2.2/platform/security/sl_component/se_manager/src -I../gecko_sdk_4.2.2/util/silicon_labs/silabs_core/memory_manager -I../gecko_sdk_4.2.2/app/flex/component/rail/sl_flex_rail_sleep -I../gecko_sdk_4.2.2/platform/common/toolchain/inc -I../gecko_sdk_4.2.2/platform/service/system/inc -I../gecko_sdk_4.2.2/platform/service/sleeptimer/inc -I../config -I../config/rail -I../autogen -I../ownTempo -I../ownSources   -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
In file included from ../gecko_sdk_4.2.2/platform/service/power_manager/inc/sl_power_manager.h:37,
                 from main.c:37:
../gecko_sdk_4.2.2/platform/Device/SiliconLabs/EFR32ZG28/Include/em_device.h:93:2: error: #error "em_device.h: PART NUMBER undefined"
   93 | #error "em_device.h: PART NUMBER undefined"
      |  ^~~~~
In file included from ../gecko_sdk_4.2.2/platform/service/power_manager/inc/sl_power_manager.h:38:
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:74:33: error: 'EXT_IRQ_COUNT' undeclared here (not in a function)
   74 | #define CORE_NVIC_REG_WORDS   ((EXT_IRQ_COUNT + 31) / 32)
      |                                 ^~~~~~~~~~~~~
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:298:14: note: in expansion of macro 'CORE_NVIC_REG_WORDS'
  298 |   uint32_t a[CORE_NVIC_REG_WORDS];    /*!< Array of NVIC mask words. */
      |              ^~~~~~~~~~~~~~~~~~~
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:318:25: error: unknown type name 'IRQn_Type'
  318 | bool  CORE_IrqIsBlocked(IRQn_Type irqN);
      |                         ^~~~~~~~~
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:329:27: error: unknown type name 'IRQn_Type'
  329 | void  CORE_NvicMaskSetIRQ(IRQn_Type irqN, CORE_nvicMask_t *mask);
      |                           ^~~~~~~~~
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:330:29: error: unknown type name 'IRQn_Type'
  330 | void  CORE_NvicMaskClearIRQ(IRQn_Type irqN, CORE_nvicMask_t *mask);
      |                             ^~~~~~~~~
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:331:28: error: unknown type name 'IRQn_Type'
  331 | bool  CORE_NvicIRQDisabled(IRQn_Type irqN);
      |                            ^~~~~~~~~
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:333:35: error: unknown type name 'IRQn_Type'
  333 | void *CORE_GetNvicRamTableHandler(IRQn_Type irqN);
      |                                   ^~~~~~~~~
../gecko_sdk_4.2.2/platform/emlib/inc/em_core.h:334:35: error: unknown type name 'IRQn_Type'
  334 | void  CORE_SetNvicRamTableHandler(IRQn_Type irqN, void *handler);
      |                                   ^~~~~~~~~
In file included from ../gecko_sdk_4.2.2/platform/radio/rail_lib/common/rail_types.h:4736,
                 from ../gecko_sdk_4.2.2/platform/radio/rail_lib/common/rail.h:38,
                 from ../ownHeaders/app_init.h:36,
                 from main.c:39:
../gecko_sdk_4.2.2/platform/radio/rail_lib/chip/efr32/efr32xg2x/rail_chip_specific.h:153:2: error: #error "Unsupported platform!"
  153 | #error "Unsupported platform!"
      |  ^~~~~
../gecko_sdk_4.2.2/platform/radio/rail_lib/chip/efr32/efr32xg2x/rail_chip_specific.h:610:2: error: #error "This config is not valid, RAIL_RF_PATHS has to be either 1 or 2"
  610 | #error "This config is not valid, RAIL_RF_PATHS has to be either 1 or 2"
      |  ^~~~~
In file included from main.c:65:
../ownHeaders/tlcd_gd3632_v4.h:186:24: warning: backslash and newline separated by space
  186 |  true,true,true,true,  \
      |                         
../ownHeaders/tlcd_gd3632_v4.h:516:16: error: expected ';' before 'void'
  516 | static __INLINE  void HLCD_Blink(bool b_blink)
      |                ^ ~~~~
      |                ;
../ownHeaders/tlcd_gd3632_v4.h: In function 'HLCD_Blink':
../ownHeaders/tlcd_gd3632_v4.h:518:3: warning: implicit declaration of function 'LCD_BlinkEnable' [-Wimplicit-function-declaration]
  518 |   LCD_BlinkEnable(b_blink);
      |   ^~~~~~~~~~~~~~~
make[1]: Leaving directory '/builds/root/honeyhtx02/ownSources'
make[1]: *** [Makefile:375: main.o] Error 1
make: *** [Makefile:331: all-recursive] Error 1
ERROR: Job failed: exit code 1

My .gitlab-ci.yml

image: gcc

variables:
  SONAR_SERVER_URL: ${SonarQube_URL} # Replace with your SonarQube server URL
  SONAR_SCANNER_VERSION: 5.0.1.3006 # Find the latest version in the "Linux" link on this page:
                                    # https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
  BUILD_WRAPPER_OUT_DIR: build-wrapper-out/ # Directory where build-wrapper output will be placed
  
  SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
  GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
  # note that SONAR_TOKEN is transmitted to the environment through Gitlab CI

get-sonar-binaries:
  # this job download and unpacks the build-wrapper and the sonar-scanner
  # in this example it is done for every build.
  # This can be optimized by caching the files or better, by including them, in the build docker image.
  stage: .pre
  script:
    # Download sonar-scanner
    - curl -sSLo sonar-scanner.zip "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip"
    - unzip -o sonar-scanner.zip 
    - mv sonar-scanner-${SONAR_SCANNER_VERSION}-linux sonar-scanner
    # Download build-wrapper
    - curl -sSLo build-wrapper.zip "${SONAR_SERVER_URL}/static/cpp/build-wrapper-linux-x86.zip" 
    - unzip -o build-wrapper.zip
    - mv build-wrapper-linux-x86 build-wrapper
  cache:
    policy: push
    key: "${CI_COMMIT_SHORT_SHA}"
    paths:
      - build-wrapper/ # to share the build-wrapper between jobs
      - sonar-scanner/ # to share the sonar-scanner between jobs

build:
  stage: build
  # install the necessary build tools when needed
  before_script:
    - apt update && apt -y install autotools-dev
  script:
    # prepare the build tree
    - autoreconf --install
    - ./configure
    # run the build inside the build wrapper
    - build-wrapper/build-wrapper-linux-x86-64 --out-dir "${BUILD_WRAPPER_OUT_DIR}" make clean all
  artifacts:
    paths:
      - sonar_scanner_example
  cache:
    policy: pull-push
    key: "${CI_COMMIT_SHORT_SHA}"
    paths:
      - build-wrapper/
      - sonar-scanner/
      - "${BUILD_WRAPPER_OUT_DIR}"

sonarqube-check:
  stage: .post
  cache:
    policy: pull
    key: "${CI_COMMIT_SHORT_SHA}"
    paths:
      - sonar-scanner/
      - "${BUILD_WRAPPER_OUT_DIR}"
  script:
    - sonar-scanner/bin/sonar-scanner --define sonar.host.url="${SONAR_SERVER_URL}" --define sonar.cfamily.build-wrapper-output="${BUILD_WRAPPER_OUT_DIR}"
  only:
    - merge_requests
    - main
    - develop

My Makefile.am

bin_PROGRAMS = sonar_scanner_example
sonar_scanner_example_SOURCES = main.c

AM_CPPFLAGS = -I../ownHeaders
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/Device/SiliconLabs/EFR32ZG28/Include
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/common/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/CMSIS/Core/Include
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/service/device_init/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/emlib/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/service/hfxo_manager/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_mbedtls_support/config
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_mbedtls_support/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/util/third_party/mbedtls/include
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/util/third_party/mbedtls/library
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/service/mpu/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/peripheral/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/service/power_manager/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_psa_driver/inc/public
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_psa_driver/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/radio/rail_lib/common
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/ble
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/ieee802154
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/zwave
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/radio/rail_lib/chip/efr32/efr32xg2x
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/radio/rail_lib/plugin/rail_util_callbacks
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/radio/rail_lib/plugin/rail_util_protocol
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/security/sl_component/se_manager/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/security/sl_component/se_manager/src
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/util/silicon_labs/silabs_core/memory_manager
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/app/flex/component/rail/sl_flex_rail_sleep
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/common/toolchain/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/service/system/inc
AM_CPPFLAGS += -I../gecko_sdk_4.2.2/platform/service/sleeptimer/inc

AM_CPPFLAGS += -I../config
AM_CPPFLAGS += -I../config/rail
AM_CPPFLAGS += -I../autogen
AM_CPPFLAGS += -I../ownTempo
AM_CPPFLAGS += -I../ownSources

My configure.ac

AC_INIT([sonar_scanner_example], [1.0])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_FILES([
 Makefile
 ownSources/Makefile
])
AC_OUTPUT

Code analysis with sonarqube in gitlab via CI-Pipeline

Expectation: Successful build stage. Reality: Total confusion.

2

There are 2 best solutions below

0
On

I added the required define for the board i use (EFR32ZG...) in my configure.ac .

AC_INIT([sonar_scanner_example], [1.0])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AC_DEFINE([EFR32ZG28B322F1024IM68], [1])

AC_PROG_CC
AC_CONFIG_FILES([
  Makefile
  ownSources/Makefile
])
AC_OUTPUT

and as a result the issue was solved but the next appeared.

$ build-wrapper/build-wrapper-linux-x86-64 --out-dir "${BUILD_WRAPPER_OUT_DIR}" make clean all
Making clean in ownSources
make[1]: Entering directory '/builds/root/honeyhtx02/ownSources'
test -z "sonar_scanner_example" || rm -f sonar_scanner_example
rm -f *.o
make[1]: Leaving directory '/builds/root/honeyhtx02/ownSources'
make[1]: Entering directory '/builds/root/honeyhtx02'
make[1]: Nothing to be done for 'clean-am'.
make[1]: Leaving directory '/builds/root/honeyhtx02'
Making all in ownSources
make[1]: Entering directory '/builds/root/honeyhtx02/ownSources'
gcc -DPACKAGE_NAME=\"sonar_scanner_example\" -DPACKAGE_TARNAME=\"sonar_scanner_example\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"sonar_scanner_example\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sonar_scanner_example\" -DVERSION=\"1.0\" -DEFR32ZG28B322F1024IM68=1 -DSL_COMPONENT_CATALOG_PRESENT=1 -I.  -I../ownHeaders -I../gecko_sdk_4.2.2/platform/Device/SiliconLabs/EFR32ZG28/Include -I../gecko_sdk_4.2.2/platform/common/inc -I../gecko_sdk_4.2.2/platform/CMSIS/Core/Include -I../gecko_sdk_4.2.2/platform/service/device_init/inc -I../gecko_sdk_4.2.2/platform/emlib/inc -I../gecko_sdk_4.2.2/platform/service/hfxo_manager/inc -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_mbedtls_support/config -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_mbedtls_support/inc -I../gecko_sdk_4.2.2/util/third_party/mbedtls/include -I../gecko_sdk_4.2.2/util/third_party/mbedtls/library -I../gecko_sdk_4.2.2/platform/service/mpu/inc -I../gecko_sdk_4.2.2/platform/peripheral/inc -I../gecko_sdk_4.2.2/platform/service/power_manager/inc -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_psa_driver/inc/public -I../gecko_sdk_4.2.2/platform/security/sl_component/sl_psa_driver/inc -I../gecko_sdk_4.2.2/platform/radio/rail_lib/common -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/ble -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/ieee802154 -I../gecko_sdk_4.2.2/platform/radio/rail_lib/protocol/zwave -I../gecko_sdk_4.2.2/platform/radio/rail_lib/chip/efr32/efr32xg2x -I../gecko_sdk_4.2.2/platform/radio/rail_lib/plugin/rail_util_callbacks -I../gecko_sdk_4.2.2/platform/radio/rail_lib/plugin/rail_util_protocol -I../gecko_sdk_4.2.2/platform/security/sl_component/se_manager/inc -I../gecko_sdk_4.2.2/platform/security/sl_component/se_manager/src -I../gecko_sdk_4.2.2/util/silicon_labs/silabs_core/memory_manager -I../gecko_sdk_4.2.2/app/flex/component/rail/sl_flex_rail_sleep -I../gecko_sdk_4.2.2/platform/common/toolchain/inc -I../gecko_sdk_4.2.2/platform/service/system/inc -I../gecko_sdk_4.2.2/platform/service/system/src -I../gecko_sdk_4.2.2/platform/service/sleeptimer/inc -I../config -I../config/rail -I../autogen -I../ownTempo -I../ownSources   -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
In file included from ../gecko_sdk_4.2.2/platform/Device/SiliconLabs/EFR32ZG28/Include/efr32zg28b322f1024im68.h:569,
                 from ../gecko_sdk_4.2.2/platform/Device/SiliconLabs/EFR32ZG28/Include/em_device.h:90,
                 from ../gecko_sdk_4.2.2/platform/service/power_manager/inc/sl_power_manager.h:37,
                 from main.c:37:
../gecko_sdk_4.2.2/platform/CMSIS/Core/Include/core_cm33.h: In function '__NVIC_SetVector':
../gecko_sdk_4.2.2/platform/CMSIS/Core/Include/core_cm33.h:2674:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 2674 |   uint32_t *vectors = (uint32_t *)SCB->VTOR;
      |                       ^
../gecko_sdk_4.2.2/platform/CMSIS/Core/Include/core_cm33.h: In function '__NVIC_GetVector':
../gecko_sdk_4.2.2/platform/CMSIS/Core/Include/core_cm33.h:2690:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 2690 |   uint32_t *vectors = (uint32_t *)SCB->VTOR;
      |                       ^
In file included from ../gecko_sdk_4.2.2/platform/emlib/inc/em_emu.h:38,
                 from ../gecko_sdk_4.2.2/platform/service/power_manager/inc/sl_power_manager.h:43:
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h: In function 'BUS_RegBitWrite':
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h:149:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  149 |     aliasAddr = (uint32_t)addr + PER_REG_BLOCK_SET_OFFSET;
      |                 ^
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h:151:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  151 |     aliasAddr = (uint32_t)addr + PER_REG_BLOCK_CLR_OFFSET;
      |                 ^
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h:153:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  153 |   *(volatile uint32_t *)aliasAddr = 1UL << bit;
      |    ^
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h: In function 'BUS_RegMaskedSet':
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h:225:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  225 |   uint32_t aliasAddr = (uint32_t)addr + PER_REG_BLOCK_SET_OFFSET;
      |                        ^
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h:226:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  226 |   *(volatile uint32_t *)aliasAddr = mask;
      |    ^
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h: In function 'BUS_RegMaskedClear':
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h:263:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  263 |   uint32_t aliasAddr = (uint32_t)addr + PER_REG_BLOCK_CLR_OFFSET;
      |                        ^
../gecko_sdk_4.2.2/platform/emlib/inc/em_bus.h:264:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  264 |   *(volatile uint32_t *)aliasAddr = mask;
      |    ^
../gecko_sdk_4.2.2/platform/emlib/inc/em_emu.h: In function 'EMU_DCDCLock':
../gecko_sdk_4.2.2/platform/emlib/inc/em_emu.h:1256:16: warning: conversion from 'long unsigned int' to 'uint32_t' {aka 'unsigned int'} changes value from '18446744073709507634' to '4294923314' [-Woverflow]
 1256 |   DCDC->LOCK = ~DCDC_LOCK_LOCKKEY_UNLOCKKEY;
      |                ^
In file included from main.c:57:
../gecko_sdk_4.2.2/platform/emlib/inc/em_gpio.h: In function 'GPIO_Lock':
../gecko_sdk_4.2.2/platform/emlib/inc/em_gpio.h:956:16: warning: conversion from 'long unsigned int' to 'uint32_t' {aka 'unsigned int'} changes value from '18446744073709509323' to '4294925003' [-Woverflow]
  956 |   GPIO->LOCK = ~GPIO_LOCK_LOCKKEY_UNLOCK;
      |                ^
In file included from main.c:65:
../ownHeaders/tlcd_gd3632_v4.h: At top level:
../ownHeaders/tlcd_gd3632_v4.h:186:24: warning: backslash and newline separated by space
  186 |  true,true,true,true,  \
      |                         
mv -f .deps/main.Tpo .deps/main.Po
gcc  -g -O2   -o sonar_scanner_example main.o  
/usr/bin/ld: main.o: in function `main':
/builds/root/honeyhtx02/ownSources/main.c:129: undefined reference to `sl_system_init'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:133: undefined reference to `sl_mx25_flash_shutdown'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:138: undefined reference to `SOS_InitSystem'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:139: undefined reference to `app_init'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:145: undefined reference to `sl_system_process_action'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:148: undefined reference to `app_process_action'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:152: undefined reference to `b_newTelRec'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:154: undefined reference to `EC1_TaskAnswer'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:155: undefined reference to `b_newTelRec'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:158: undefined reference to `SLT_CheckTasks'
/usr/bin/ld: /builds/root/honeyhtx02/ownSources/main.c:165: undefined reference to `sl_power_manager_sleep'
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/builds/root/honeyhtx02/ownSources'
make[1]: *** [Makefile:359: sonar_scanner_example] Error 1
make: *** [Makefile:331: all-recursive] Error 1
ERROR: Job failed: exit code 1

Besides the warnings, it seems like some function in my main.c can't be referenced. In my makefile.am paths to all required headers are listed. Some functions aren't referenced even though the paths to the source files are listed in the makefile.am as well.

0
On

Described problem has nothing to do with Gitlab and ci/cd per se. It is related to using sonar build-wrapper for building C app. I would recommend to focus your attention on the very first error in your errorlog. It says that PART NUMBER is undeclared. And I assume it is a name of the model of the microcontroller for which you're trying to build your project. Looks like without this variable, pre processor does not include device specific headers that may lead to all other errors.

I'll just extend my answer.

Those undefined reference errors you mention mean sdk binaries can't be found. You can try to add them via AM_LDFLAGS.