This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

The toolchain is unable to build a dummy C file

Evaluating nRF53 PDK. Trying to build basic samples from zephyr repo as advised here - https://devzone.nordicsemi.com/f/nordic-q-a/54451/nrf5340-support-in-nrf-connect-sdk-and-zephyr/220309#220309

Both the command line 'west' command and SES project import results in the same outcome.

Configuration saved to '/Users/.../ncs/zephyr/samples/bluetooth/hci_rpmsg/build/zephyr/.config'
-- The C compiler identification is GNU 8.3.1
-- The CXX compiler identification is GNU 8.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/.../gnuarmemb/bin/arm-none-eabi-gcc
CMake Error at ../../../cmake/extensions.cmake:1462 (message):
Assertion failed: The toolchain is unable to build a dummy C file. See
CMakeError.log.
Call Stack (most recent call first):
../../../CMakeLists.txt:42 (assert)

which says in the error of the CMakeError.log that

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /Users/.../gnuarmemb/bin/arm-none-eabi-gcc
Build flags:
Id flags:

The output was:
1
/Users/.../gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: /Users/...s/gnuarmemb/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2: error: ld returned 1 exit status

I would try to specify something like https://stackoverflow.com/questions/19419782/exit-c-text0x18-undefined-reference-to-exit-when-using-arm-none-eabi-gcc but I am fairly novice in zephyr projects.

Parents
  • How to solve Windows 10,if I try to delete \zephyr\cache, it doesn't work

    D:\blog\ncs1\version\nrf\applications\nrf_desktop>west build -bnrf52840gmouse_nrf52840 -p
    -- west build: generating a build system
    Including boilerplate (Zephyr base): D:/blog/ncs1/version/zephyr/cmake/app/boilerplate.cmake
    -- Application: D:/blog/ncs1/version/nrf/applications/nrf_desktop
    -- Using NCS Toolchain 1.4.0 for building. (D:/blog/ncs1/version/toolchain/cmake)
    -- Zephyr version: 2.4.0 (D:/blog/ncs1/version/zephyr)
    -- Found Python3: D:/blog/ncs1/version/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Found west (found suitable version "0.7.2", minimum required is "0.7.1")
    -- Board: nrf52840gmouse_nrf52840
    -- Cache files will be written to: D:/blog/ncs1/version/zephyr/.cache
    -- Found dtc: D:/blog/ncs1/version/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (D:/blog/ncs1/version/toolchain/opt)
    -- Found BOARD.dts: D:/blog/ncs1/version/nrf/boards/arm/nrf52840gmouse_nrf52840/nrf52840gmouse_nrf52840.dts
    -- Found devicetree overlay: D:/blog/ncs1/version/nrf/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/dts.overlay
    -- Generated zephyr.dts: D:/blog/ncs1/version/nrf/applications/nrf_desktop/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: D:/blog/ncs1/version/nrf/applications/nrf_desktop/build/zephyr/include/generated/devicetree_unfixed.h
    Parsing D:/blog/ncs1/version/nrf/applications/nrf_desktop/Kconfig
    Loaded configuration 'D:/blog/ncs1/version/nrf/boards/arm/nrf52840gmouse_nrf52840/nrf52840gmouse_nrf52840_defconfig'
    Merged configuration 'configuration/nrf52840gmouse_nrf52840/app_ZDebug.conf'
    Configuration saved to 'D:/blog/ncs1/version/nrf/applications/nrf_desktop/build/zephyr/.config'
    Kconfig header saved to 'D:/blog/ncs1/version/nrf/applications/nrf_desktop/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: D:/blog/ncs1/version/toolchain/opt/bin/arm-none-eabi-gcc.exe
    CMake Error at D:/blog/ncs1/version/zephyr/cmake/extensions.cmake:1557 (message):
    Assertion failed: The toolchain is unable to build a dummy C file. See
    CMakeError.log.
    Call Stack (most recent call first):
    D:/blog/ncs1/version/zephyr/CMakeLists.txt:42 (assert)

    which says in the error of the CMakeError.log that

    Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
    Compiler: D:/blog/ncs1/version/toolchain/opt/bin/arm-none-eabi-gcc.exe
    Build flags:
    Id flags:

    The output was:
    1
    d:/blog/ncs1/version/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: d:/blog/ncs1/version/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
    exit.c:(.text.exit+0x2c): undefined reference to `_exit'
    collect2.exe: error: ld returned 1 exit status


    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
    Compiler: D:/blog/ncs1/version/toolchain/opt/bin/arm-none-eabi-gcc.exe
    Build flags:
    Id flags:

    The output was:
    1
    d:/blog/ncs1/version/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: d:/blog/ncs1/version/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-ex.....

  • I solved this error by deleting all the files in ..\v1.8.0\zephyr\.cache\ToolchainCapabilityDatabase

    OS: Windows 10

Reply Children
No Data
Related