Broken configuration where nothing will build (not even hello world in new toolchain)

I have some legacy nrf9160 devices that needs a firmware update. However, somehow my old toolchain fails with `FATAL ERROR: command exited with status 1`.

So I have tried reinstalling, creating a new toolchain in Docker, and creating a new and up to date toolchain from nrf connect. None of these options work

Weirdly enough, with a newly installed sdk v2.3.0 (windows 11 Pro version 22H2) I cannot even build hello_world, so I suspect something global is going wrong.

I want to fix that before continuing to try to build my application 

My process

1. install nrf connect sdk v2.3.0 from nrf connect

2. open shell from nrf connect

3. cd /c/ncs/v2.3.0/zephyr/samples/hello_world

4. west build -b sparkfun_thing_plus_nrf9160

which fails.

environment variables:

echo $ZEPHYR_BASE
C:\ncs\v2.3.0\zephyr

echo $ZEPHYR_TOOLCHAIN_VARIANT
gnuarmemb

echo $GNUARMEMB_TOOLCHAIN_PATH
C:\compilers\gnu_arm_embedded\10_2021_10

Only thing I can see that is off is that west does not respect the variables set and chooses another C compiler (should be the pre installed v10, but is somehow v12):

....

Kconfig header saved to 'C:/ncs/v2.3.0/zephyr/samples/hello_world/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- The ASM compiler identification is GNU

This is day 3 of debugging, so any hints on where to get started is appreciated. I can make hello_world work in a new Docker image that I made based on the guide, but not my application...

  • Hello,

    Letting you know I have been assigned to this case and I started looking into this.

    I need  some more time for checking and responding . I will get back to you soon.

    Kind Regards,

    Abhijith

  • Hi,

    Apologies for the long delay. I was out of office for some days and I missed this ticket. Could you make sure you have removed any previous installations before installing again? Also, are you doing a manual installation of the SDK or the automatic installation from the Toolchain Manager? It's always better to use the automatic installation.

    Also, could also try to "Update SDK" and "Update Toolchain"?

    Kind Regards,

    Abhijith

  • I updated to the newest sdk, reinstalled everything. Via the Toolchain Manager of course. I avoided the problem by using the docker image from nordicplayground..

    Tried with different boards, still no build. So its not an nRF9160 specific issue, but an issue with my environment.

    Is there a list somewhere of global environment variables that affect the build?
    For reference i have like 3 python versions, lots of other C compilers on my path, but from the logs it looks like the tools from the ncs tools folder are being used as expected..

    I'm really impressed by an installation tool where hello world does not work for a toolchain...

    Output log from clean install and just the hello world example:

    xecuting task: nRF Connect: Generate config nrf52840dk_nrf52840 for c:\work\firmware\hello_ncs\hello_world

    Building hello_world
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir c:/work/firmware/hello_ncs/hello_world/build c:/work/firmware/hello_ncs/hello_world --pristine --board nrf52840dk_nrf52840 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y"

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/work/firmware/hello_ncs/hello_world
    -- CMake version: 3.20.5
    -- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.4.0/zephyr/.cache
    -- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr)
    -- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs/v2.4.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: C:/work/firmware/hello_ncs/hello_world/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/work/firmware/hello_ncs/hello_world/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/work/firmware/hello_ncs/hello_world/build/zephyr/dts.cmake
    Parsing C:/ncs/v2.4.0/zephyr/Kconfig
    Loaded configuration 'C:/ncs/v2.4.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration 'C:/work/firmware/hello_ncs/hello_world/prj.conf'
    Merged configuration 'C:/work/firmware/hello_ncs/hello_world/build/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to 'C:/work/firmware/hello_ncs/hello_world/build/zephyr/.config'
    Kconfig header saved to 'C:/work/firmware/hello_ncs/hello_world/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/31f4403e35/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/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Warning at C:/ncs/v2.4.0/zephyr/CMakeLists.txt:838 (message):
      No SOURCES given to Zephyr library: lib__libc__common

      Excluding target from build.


    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/work/firmware/hello_ncs/hello_world/build
    -- west build: building application
    [1/169] Generating include/generated/version.h
    -- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr), build: v3.3.99-ncs1
    [2/169] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
    [3/169] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
    [4/169] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h, include/generated/otype-to-size.h
    [5/169] Generating include/generated/driver-validation.h
    [6/169] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
    FAILED: zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
    ccache C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DNRF52840_XXAA -DUSE_PARTITION_MANAGER=0 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.4.0/zephyr/kernel/include -IC:/ncs/v2.4.0/zephyr/arch/arm/include -IC:/ncs/v2.4.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.4.0/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/ncs/v2.4.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.4.0/nrf/include -IC:/ncs/v2.4.0/nrf/tests/include -IC:/ncs/v2.4.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.4.0/modules/hal/nordic/nrfx -IC:/ncs/v2.4.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.4.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.4.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.4.0/modules/debug/segger/SEGGER -IC:/ncs/v2.4.0/modules/debug/segger/Config -IC:/ncs/v2.4.0/zephyr/modules/segger/. -isystem C:/ncs/v2.4.0/zephyr/lib/libc/minimal/include -isystem c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem C:/ncs/v2.4.0/nrfxlib/crypto/nrf_cc310_platform/include -fno-strict-aliasing -Og -imacros C:/work/firmware/hello_ncs/hello_world/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs --sysroot=C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.4.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/work/firmware/hello_ncs/hello_world=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.4.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.4.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj -MF zephyr\CMakeFiles\offsets.dir\arch\arm\core\offsets\offsets.c.obj.d -o zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj -c C:/ncs/v2.4.0/zephyr/arch/arm/core/offsets/offsets.c
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\31f4403e35\opt\bin\cmake.EXE' --build 'c:\work\firmware\hello_ncs\hello_world\build'

     *  The terminal process terminated with exit code: 1.
     *  Terminal will be reused by tasks, press any key to close it.

  • Hello,

    magnusE said:
    No SOURCES given to Zephyr library: lib__libc__common

      Excluding target from build.

    Please take a look at this old thread from my colleague which discuss about the same error.

    Kind Regards,

    Abhijith

Related