I cannot seem to solve this issue with my program build. here are the details.
I'm using the Seeed XIAO nRF52840 microprocessor.
I'm using a Windows 11 laptop.
est build --build-dir c:/Users/raybo/blexiaotest/build c:/Users/raybo/blexiaotest --pristine --board xiao_ble --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=c:/Users/raybo/blexiaotest/prj.conf -DDTC_OVERLAY_FILE=c:/Users/raybo/blexiaotest/xiao_ble.overlay
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Users/raybo/blexiaotest
-- CMake version: 3.20.5
-- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.5.1/zephyr/.cache
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: xiao_ble
-- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.5.1/zephyr/boards/arm/xiao_ble/xiao_ble.dts
-- Found devicetree overlay: c:/Users/raybo/blexiaotest/xiao_ble.overlay
-- Generated zephyr.dts: C:/Users/raybo/blexiaotest/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/raybo/blexiaotest/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/raybo/blexiaotest/build/zephyr/dts.cmake
warning: The choice symbol USB_CDC_ACM_LOG_LEVEL_OFF (defined at
subsys/logging/Kconfig.template.log_config:8) was selected (set =y), but no symbol ended up as the
choice selection. See
docs.zephyrproject.org/.../kconfig.html and/or look up
USB_CDC_ACM_LOG_LEVEL_OFF in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.
Parsing C:/ncs/v2.5.1/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.5.1/zephyr/boards/arm/xiao_ble/xiao_ble_defconfig'
Merged configuration 'c:/Users/raybo/blexiaotest/prj.conf'
Configuration saved to 'C:/Users/raybo/blexiaotest/build/zephyr/.config'
Kconfig header saved to 'C:/Users/raybo/blexiaotest/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.5.1/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
CONFIG_USB_DEVICE_VID has default value 0x2FE3.
This value is only for testing and MUST be configured for USB products.
CMake Warning at C:/ncs/v2.5.1/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
CONFIG_USB_DEVICE_PID has default value 0x100.
This value is only for testing and MUST be configured for USB products.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/raybo/blexiaotest/build
-- west build: building application
[2/187] Generating include/generated/version.h
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr), build: v3.4.99-ncs1-1
[36/187] Building C object CMakeFiles/app.dir/src/main.c.obj
../src/main.c:22:29: warning: 'ad' defined but not used [-Wunused-const-variable=]
22 | static const struct bt_data ad[] = {
| ^~
[182/187] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\Users\raybo\blexiaotest\build\zephyr && C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj): in function `my_read_temperature_function':
C:\Users\raybo\blexiaotest\build/../src/main.c:38: undefined reference to `bt_gatt_attr_read'
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj):(.rodata.attr_custom_srv+0x4): undefined reference to `bt_gatt_attr_read_service'
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj):(.rodata.attr_custom_srv+0x18): undefined reference to `bt_gatt_attr_read_chrc'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Users\raybo\blexiaotest\build'
* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
* Executing task: nRF Connect: Build [pristine]: blexiaotest/build (active)
Building blexiaotest
west build --build-dir c:/Users/raybo/blexiaotest/build c:/Users/raybo/blexiaotest --pristine --board xiao_ble --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=c:/Users/raybo/blexiaotest/prj.conf -DDTC_OVERLAY_FILE=c:/Users/raybo/blexiaotest/xiao_ble.overlay
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Users/raybo/blexiaotest
-- CMake version: 3.20.5
-- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.5.1/zephyr/.cache
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: xiao_ble
-- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.5.1/zephyr/boards/arm/xiao_ble/xiao_ble.dts
-- Found devicetree overlay: c:/Users/raybo/blexiaotest/xiao_ble.overlay
-- Generated zephyr.dts: C:/Users/raybo/blexiaotest/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/raybo/blexiaotest/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/raybo/blexiaotest/build/zephyr/dts.cmake
warning: The choice symbol USB_CDC_ACM_LOG_LEVEL_OFF (defined at
subsys/logging/Kconfig.template.log_config:8) was selected (set =y), but no symbol ended up as the
choice selection. See
docs.zephyrproject.org/.../kconfig.html and/or look up
USB_CDC_ACM_LOG_LEVEL_OFF in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.
Parsing C:/ncs/v2.5.1/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.5.1/zephyr/boards/arm/xiao_ble/xiao_ble_defconfig'
Merged configuration 'c:/Users/raybo/blexiaotest/prj.conf'
Configuration saved to 'C:/Users/raybo/blexiaotest/build/zephyr/.config'
Kconfig header saved to 'C:/Users/raybo/blexiaotest/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.5.1/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
CONFIG_USB_DEVICE_VID has default value 0x2FE3.
This value is only for testing and MUST be configured for USB products.
CMake Warning at C:/ncs/v2.5.1/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
CONFIG_USB_DEVICE_PID has default value 0x100.
This value is only for testing and MUST be configured for USB products.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/raybo/blexiaotest/build
-- west build: building application
[2/187] Generating include/generated/version.h
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr), build: v3.4.99-ncs1-1
[39/187] Building C object CMakeFiles/app.dir/src/main.c.obj
../src/main.c:22:29: warning: 'ad' defined but not used [-Wunused-const-variable=]
22 | static const struct bt_data ad[] = {
| ^~
[182/187] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\Users\raybo\blexiaotest\build\zephyr && C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: cannot find -lbt: No such file or directory
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Users\raybo\blexiaotest\build'
* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
* Executing task: nRF Connect: Build [pristine]: blexiaotest/build (active)
Building blexiaotest
west build --build-dir c:/Users/raybo/blexiaotest/build c:/Users/raybo/blexiaotest --pristine --board xiao_ble --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=c:/Users/raybo/blexiaotest/prj.conf -DDTC_OVERLAY_FILE=c:/Users/raybo/blexiaotest/xiao_ble.overlay
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Users/raybo/blexiaotest
-- CMake version: 3.20.5
-- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.5.1/zephyr/.cache
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: xiao_ble
-- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.5.1/zephyr/boards/arm/xiao_ble/xiao_ble.dts
-- Found devicetree overlay: c:/Users/raybo/blexiaotest/xiao_ble.overlay
-- Generated zephyr.dts: C:/Users/raybo/blexiaotest/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/raybo/blexiaotest/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/raybo/blexiaotest/build/zephyr/dts.cmake
warning: The choice symbol USB_CDC_ACM_LOG_LEVEL_OFF (defined at
subsys/logging/Kconfig.template.log_config:8) was selected (set =y), but no symbol ended up as the
choice selection. See
docs.zephyrproject.org/.../kconfig.html and/or look up
USB_CDC_ACM_LOG_LEVEL_OFF in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.
Parsing C:/ncs/v2.5.1/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.5.1/zephyr/boards/arm/xiao_ble/xiao_ble_defconfig'
Merged configuration 'c:/Users/raybo/blexiaotest/prj.conf'
Configuration saved to 'C:/Users/raybo/blexiaotest/build/zephyr/.config'
Kconfig header saved to 'C:/Users/raybo/blexiaotest/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.5.1/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
CONFIG_USB_DEVICE_VID has default value 0x2FE3.
This value is only for testing and MUST be configured for USB products.
CMake Warning at C:/ncs/v2.5.1/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
CONFIG_USB_DEVICE_PID has default value 0x100.
This value is only for testing and MUST be configured for USB products.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/raybo/blexiaotest/build
-- west build: building application
[2/187] Generating include/generated/version.h
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.1/zephyr), build: v3.4.99-ncs1-1
[39/187] Building C object CMakeFiles/app.dir/src/main.c.obj
../src/main.c:22:29: warning: 'ad' defined but not used [-Wunused-const-variable=]
22 | static const struct bt_data ad[] = {
| ^~
[182/187] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\Users\raybo\blexiaotest\build\zephyr && C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: cannot find -lbt: No such file or directory
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Users\raybo\blexiaotest\build'
Here is the main.c code.