Gitlab 构建阶段:在 make 过程中,对于应该处于非活动状态的代码段出现错误/警告
我的 gitlab 构建阶段在 make-phase 期间退出,错误代码为 1,因为代码无效(在 IDE 中显示为灰色,但在上传到存储库的 .c/.h 文件中未显示)。
作为示例,我想指出以下错误消息:
示例错误消息
../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"
| ^~~~~
在我的 IDE 中,这段特定的代码显示为灰色,这意味着应该忽略它。 在 IDE 中
如何修复所有问题,我必须在哪里更改我的配置。
我的构建过程错误日志:
$ 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
我的 .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
我的 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
我的 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
通过 CI-Pipeline 在 gitlab 中使用 sonarqube 进行代码分析
期望:构建阶段成功。 现实:完全混乱。
所述问题与 Gitlab 和 ci/cd 本身无关。它与使用 sonar build-wrapper 构建 C 应用程序有关。 我建议您将注意力集中在错误日志中的第一个错误上。它说 PART NUMBER 未声明。我假设它是您尝试为其构建项目的微控制器型号的名称。看起来如果没有这个变量,预处理器就不会包含可能导致所有其他错误的设备特定标头。
我只是扩展我的答案。
您提到的那些 未定义的引用 错误意味着找不到 sdk 二进制文件。您可以尝试通过 AM_LDFLAGS 添加它们。
我在 configure.ac 中添加了我使用的主板 (EFR32ZG...) 所需的定义。
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
结果问题解决了,但出现了下一个问题。
$ 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
除了警告之外,似乎我的 main.c 中的某些函数无法引用。在我的 makefile.am 中列出了所有必需头文件的路径。即使 makefile.am 中也列出了源文件的路径,但某些函数未被引用。