exit.c:(.text.exit+0x34): undefined reference to `_exit' on ncs v2.4.2

West build failed with the following error messages when I set CONFIG_BOOTLOADER_MCUBOOT=y in prj.conf file. But west build successfully when I set CONFIG_BOOTLOADER_MCUBOOT=n. Do you have any suggestion to debug this issue?

-- Configuring incomplete, errors occurred!
CMake Error at C:/ncs/v2.4.2/nrf/cmake/multi_image.cmake:440 (message):
  CMake generation for mcuboot failed, aborting.  Command: 1
Call Stack (most recent call first):
  C:/ncs/v2.4.2/nrf/cmake/multi_image.cmake:169 (add_child_image_from_source)
  C:/ncs/v2.4.2/nrf/modules/mcuboot/CMakeLists.txt:258 (add_child_image)


-- Configuring incomplete, errors occurred!
See also "C:/ncs/v2.4.2/nrf/samples/bt/build/CMakeFiles/CMakeOutput.log".
See also "C:/ncs/v2.4.2/nrf/samples/bt/build/CMakeFiles/CMakeError.log".

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x34): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x34): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status

Parents Reply Children
  • I have fixed this issue by moving the following dts nodes from to nrf5340_cpuapp_common.dts to overlay file since nrf5340_cpuapp_common-pinctrl.dtsi doesn't contain pin configuration of i2c0 and i2c1.

    &i2c0 {
        compatible = "nordic,nrf-twim";
        status = "okay";
        clock-frequency = <I2C_BITRATE_STANDARD>;
        pinctrl-0 = <&i2c0_default>;
        pinctrl-1 = <&i2c0_sleep>;
        pinctrl-names = "default", "sleep";
    };
    
    &i2c1 {
        compatible = "nordic,nrf-twim";
        status = "okay";
        clock-frequency = <I2C_BITRATE_STANDARD>;
        pinctrl-0 = <&i2c1_default>;
        pinctrl-1 = <&i2c1_sleep>;
        pinctrl-names = "default", "sleep";
    };

Related