I just received a nRF52840 DK from Nordic. After installed the nRF Connect SDK and the toolchain (Using the nRF Connect for VSC extension in Visual Studio Code), I created an application based on samples provide with the SDK (zephyr/samples/hello_world)
Then I connected my Nordic nRF52840 DK to my computer and tried to build the sample without changing anything, literally just create the app and start the build.
When trying to build the application by using west -v build
or directly by the Build
action in the nRF Connect for VSC extension, it throws me this error: (west -v
is for verbose output)
<code>cmake version 3.17.2 is OK; minimum version is 3.13.1
Running CMake: 'C:ncstoolchainscf2149caf2optbincmake.EXE' --build 'C:ncsv2.6.1hello_worldbuild' -- -v
ninja: error: loading 'build.ninja': The system cannot find the file specified.
FATAL ERROR: command exited with status 1: 'C:ncstoolchainscf2149caf2optbincmake.EXE' --build
'C:ncsv2.6.1hello_worldbuild' -- -v
<code>cmake version 3.17.2 is OK; minimum version is 3.13.1
Running CMake: 'C:ncstoolchainscf2149caf2optbincmake.EXE' --build 'C:ncsv2.6.1hello_worldbuild' -- -v
ninja: error: loading 'build.ninja': The system cannot find the file specified.
FATAL ERROR: command exited with status 1: 'C:ncstoolchainscf2149caf2optbincmake.EXE' --build
'C:ncsv2.6.1hello_worldbuild' -- -v
</code>
cmake version 3.17.2 is OK; minimum version is 3.13.1
Running CMake: 'C:ncstoolchainscf2149caf2optbincmake.EXE' --build 'C:ncsv2.6.1hello_worldbuild' -- -v
ninja: error: loading 'build.ninja': The system cannot find the file specified.
FATAL ERROR: command exited with status 1: 'C:ncstoolchainscf2149caf2optbincmake.EXE' --build
'C:ncsv2.6.1hello_worldbuild' -- -v
This is the CMakeError.log:
<code>Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/liblibc.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/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/liblibc.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
<code>Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
Build flags:
Id flags:
The output was:
1
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/liblibc.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/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
Build flags:
Id flags:
The output was:
1
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/liblibc.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
</code>
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
Build flags:
Id flags:
The output was:
1
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/liblibc.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/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
Build flags:
Id flags:
The output was:
1
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/liblibc.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
At first, I was thinking that Ninja isn’t installed nicely but after some researches I saw this question and I got the same symptoms so I thought it wasn’t my fault (but honestly, it’s probably my fault).
However, I tried with cmake 3.21.0 and 3.17.2 and also with ninja 1.12.1 and 1.10.2 but nothing change, I reinstalled west but it didn’t work too. I reinstalled 2 times the toolchain and the SDK just to be sure.
I did erase the .cache
directory
I’m using the nRF SDK v2.6.1 (the latest release). I tried to validate the toolchain by using the VSC extension and apparently, no issues were found.
I know that my problem doesn’t come from the devkit: I successfully flashed a provided hex file by using the nRF Connect Desktop app.
Does someone have an idea about what did I do wrong or what can I try ?