nRF Connect SDK Linux Installation & Compiling Failure

Hi,

I installed nRF Connect SDK manually by following the instruction in this page. I had 2 problems but I did a trick and it seems it solved for now. However I need to know for the future.

OS: Ubuntu 22.04

ncs: In home directory and the structure is lie below.

ncs
 |___ .west
 |___ bootloader
 |___ modules
 |___ nrf
 |___ nrfxlib
 |___ zephyr
 |___ ...

SDK: In home directory with the name like zephyr-sdk-0.14.1 and also isntalled 0.15.1 at the same time. However VSCode has given an error that v2.2.0 requires zephyr-sdk-0.15.1. It couldn't detect automatically. I have checked the $PATH env. var. There is no toolchain variable in it, but I don't understand how VScode can find 0.14.1. Anyway I renamed folders 0.14.1 to 0.15.1 and 0.15.1 to 0.14.1. Now VSCode doesn't give any error and it accepts. It seems that this problem has been solved temporarily.

The setting VSCode extention:

nRF Connect SDK: 2.2.0 (/home/soz/ncs)        => as detected

nRF Connect Toolchain: PATH (Zephyr SDK: /home/soz/zephyr-sdk-0.14.1)     => as detected. 0.15.1 couldn't detected so as mentioned above renamed folder.

Output of PATH env.

soz@salihonur-lnx:~/ncs/zephyr$ echo $PATH
/home/soz/ncs/zephyr/scripts:/home/soz/.local/bin:/home/soz/gn:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/soz/nRF52/gcc-arm/bin
soz@salihonur-lnx:~/ncs/zephyr$

Output of ZEPHYR_BASE variable:

soz@salihonur-lnx:~$ echo $ZEPHYR_BASE

soz@salihonur-lnx:~$ cd ncs/zephyr/
soz@salihonur-lnx:~/ncs/zephyr$ source zephyr-env.sh 
soz@salihonur-lnx:~/ncs/zephyr$ echo $ZEPHYR_BASE
/home/soz/ncs/zephyr
soz@salihonur-lnx:~/ncs/zephyr$ echo $BOARD

soz@salihonur-lnx:~/ncs/zephyr$ echo $CONF_FILE

soz@salihonur-lnx:~/ncs/zephyr$ echo $DTS_OVERLAY_FILE

Error of compling "blinky" example in VSCode:

Building blinky
west build --build-dir /home/soz/ELEKTRONIK/Test/blinky/build_1 /home/soz/ELEKTRONIK/Test/blinky --pristine --board nrf52840dongle_nrf52840 -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONF_FILE:STRING="/home/soz/ELEKTRONIK/Test/blinky/prj.conf"

-- west build: generating a build system
STATUS,XXXXX: 
Loading Zephyr default modules (Zephyr base).
-- Application: /home/soz/ELEKTRONIK/Test/blinky
-- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.6") found components: Interpreter 
-- Cache files will be written to: /home/soz/.cache/zephyr
-- Zephyr version: 3.2.99 (/home/soz/ncs/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf52840dongle_nrf52840
-- Found host-tools: zephyr 0.15.1 (/home/soz/zephyr-sdk-0.14.1)
-- Found toolchain: zephyr 0.15.1 (/home/soz/zephyr-sdk-0.14.1)
-- Found Dtc: /home/soz/zephyr-sdk-0.14.1/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (Required is at least version "1.4.6") 
-- Found BOARD.dts: /home/soz/ncs/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
-- Generated zephyr.dts: /home/soz/ELEKTRONIK/Test/blinky/build_1/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/soz/ELEKTRONIK/Test/blinky/build_1/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/soz/ELEKTRONIK/Test/blinky/build_1/zephyr/dts.cmake
CMake Error at /home/soz/ncs/zephyr/cmake/modules/dts.cmake:308 (message):
  command failed with return code: No such file or directory
Call Stack (most recent call first):
  /home/soz/ncs/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
  /home/soz/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:67 (include)
  /home/soz/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:93 (include_boilerplate)
  CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /home/soz/.local/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/soz/ELEKTRONIK/Test/blinky/build_1 -GNinja -DBOARD=nrf52840dongle_nrf52840 -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DCONF_FILE:STRING=/home/soz/ELEKTRONIK/Test/blinky/prj.conf -S/home/soz/ELEKTRONIK/Test/blinky

Questions:

  1. I guess the compiler can't find PATH variables. Only ZEPHYR_BASE variable comes if "source zephyr-env.sh" is executed. What are the default location of these variables below? I can define them manually.
    BOARD
    CONF_FILE
    SHIELD
    ZEPHYR_BASE
    ZEPHYR_EXTRA_MODULES
    ZEPHYR_MODULES
    ZEPHYR_BOARD_ALIASES

    ZEPHYR_SDK_INSTALL_DIR
    ZEPHYR_TOOLCHAIN_VARIANT
    {TOOLCHAIN}_TOOLCHAIN_PATH
  2. Where can I change the toolchain path?
  • Now the build function works. However I'm still getting the compiling error same as VSCode.

    soz@salihonur-lnx:~/ELEKTRONIK/Test/blinky$ west build -b nrf52840dongle_nrf52840
    -- west build: generating a build system
    STATUS,XXXXX: 
    Loading Zephyr default modules (Zephyr base).
    -- Application: /home/soz/ELEKTRONIK/Test/blinky
    -- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.6") found components: Interpreter 
    -- Cache files will be written to: /home/soz/.cache/zephyr
    -- Zephyr version: 3.2.99 (/home/soz/ncs/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52840dongle_nrf52840
    -- Found host-tools: zephyr 0.15.1 (/home/soz/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.1 (/home/soz/zephyr-sdk)
    -- Found Dtc: /home/soz/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (Required is at least version "1.4.6") 
    -- Found BOARD.dts: /home/soz/ncs/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
    -- Generated zephyr.dts: /home/soz/ELEKTRONIK/Test/blinky/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /home/soz/ELEKTRONIK/Test/blinky/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /home/soz/ELEKTRONIK/Test/blinky/build/zephyr/dts.cmake
    CMake Error at /home/soz/ncs/zephyr/cmake/modules/dts.cmake:308 (message):
      command failed with return code: No such file or directory
    Call Stack (most recent call first):
      /home/soz/ncs/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
      /home/soz/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:67 (include)
      /home/soz/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:93 (include_boilerplate)
      CMakeLists.txt:4 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: /home/soz/.local/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/soz/ELEKTRONIK/Test/blinky/build -GNinja -DBOARD=nrf52840dongle_nrf52840 -S/home/soz/ELEKTRONIK/Test/blinky
    

  • Hi,

    I will continue helping in this case.

    Can you run the following command and upload the log file?

    cd ncs/zephyr
    tree > tree_log.txt

    Regards,
    Sigurd Hellesvik

  • From the log, I can find the file I thought were missing, so that should be fine.

    Can you try  to build the zephyr/samples/hello_world sample, and see if you still get the same error?

    I had 2 problems but I did a trick and it seems it solved for now.

    By the way, what was this trick?

    Regards,
    Sigurd Hellesvik

  • Unfortunately same. Here is the output.

    soz@salihonur-lnx:~$ cd ncs/zephyr/samples/hello_world/
    soz@salihonur-lnx:~/ncs/zephyr/samples/hello_world$ west build -b nrf52840dongle_nrf52840
    -- west build: generating a build system
    STATUS,XXXXX: /home/soz/ncs/zephyr
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: /home/soz/ncs/zephyr/samples/hello_world
    -- Cache files will be written to: /home/soz/.cache/zephyr
    -- Zephyr version: 3.2.99 (/home/soz/ncs/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52840dongle_nrf52840
    -- Found host-tools: zephyr 0.15.1 (/home/soz/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.1 (/home/soz/zephyr-sdk)
    -- Found BOARD.dts: /home/soz/ncs/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
    -- Generated zephyr.dts: /home/soz/ncs/zephyr/samples/hello_world/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /home/soz/ncs/zephyr/samples/hello_world/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /home/soz/ncs/zephyr/samples/hello_world/build/zephyr/dts.cmake
    CMake Error at /home/soz/ncs/zephyr/cmake/modules/dts.cmake:308 (message):
      command failed with return code: No such file or directory
    Call Stack (most recent call first):
      /home/soz/ncs/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
      /home/soz/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:67 (include)
      /home/soz/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:98 (include_boilerplate)
      CMakeLists.txt:5 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: /home/soz/.local/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/soz/ncs/zephyr/samples/hello_world/build -GNinja -S/home/soz/ncs/zephyr/samples/hello_world
    

    I found something interesting. If I set ZEPHYR_TOOLCHAIN_VARIANT=zephyr then VSCode can't find the toolchain path even if ZEPHYR_SDK_INSTALL_DIR=${HOME}/zephyr-sdk is already set.

    About the tick:

    At the begging there were 2 version zephyr-sdk-0.14.1 and zephyr-sdk-0.15.1 in the home directory. VScode. By the way only ZEPHYR_SDK_INSTALL_DIR variable was set to 0.15.1. However VSCode couldn't find 0.15.1, it was finding 0.14.1. Then I did a trick and changed the folder name. It solved.

    A few days later I removed 0.14.1 named folder then VSCode could find 0.15.1. Then I figured out that VSCode looks up folder names in ascending. Finally I removed all sdk folder and created a new folder as zephyr-sdk with the 0.15.1 version.

    I think VSCode automatically finds the folder with the name zephyr-sdk. It doesn't accept underscores or a name in different format.

    I will try another installation on a virtual machine and I will record it. I can upload it to Youtube and share the link as well.

    Hope to find a solution next week, happy new year in advance. Santa

Related