nrfutil using the incorrect toolchain

I have set nrfutil to use the v2.5.0 toolchain:

burt@T420s:~$ nrfutil toolchain-manager list
  Version  Toolchain
* v2.5.0   /home/burt/ncs/toolchains/7795df4459
  v2.7.0   /home/burt/ncs/toolchains/e9dba88316

Next I

burt@T420s:~$ nrfutil toolchain-manager launch --shell
Initializing shell environment!

(v2.5.0) burt@T420s:~$ cd ncs/v2.5.0/nrf/applications/asset_tracker_v2/

(v2.5.0) burt@T420s:~/ncs/v2.5.0/nrf/applications/asset_tracker_v2$ rm -rf build_nrf9160dk
(v2.5.0) burt@T420s:~/ncs/v2.5.0/nrf/applications/asset_tracker_v2$ west build -b nrf9160dk_nrf9160_ns -d build_nrf9160dk
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/burt/ncs/v2.5.0/nrf/applications/asset_tracker_v2
-- CMake version: 3.20.5
-- Using NCS Toolchain 2.6.20240605.1004412633878 for building. (/home/burt/ncs/toolchains/e9dba88316/cmake)
CMake Deprecation Warning at /home/burt/ncs/v2.5.0/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
  'PYTHON_PREFER' variable is deprecated.  Please use Python3_EXECUTABLE
  instead.
Call Stack (most recent call first):
  /home/burt/ncs/v2.5.0/zephyr/cmake/modules/python.cmake:16 (find_package)
  /home/burt/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  /home/burt/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/burt/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:9 (find_package)


CMake Error at /home/burt/ncs/toolchains/7795df4459/usr/local/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3 (missing: Interpreter) (Required is at least version
  "3.8")

      Reason given by package:
          Interpreter: Cannot run the interpreter "/home/burt/ncs/toolchains/e9dba88316/usr/local/bin/python3"

Call Stack (most recent call first):
  /home/burt/ncs/toolchains/7795df4459/usr/local/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /home/burt/ncs/toolchains/7795df4459/usr/local/share/cmake-3.20/Modules/FindPython/Support.cmake:3165 (find_package_handle_standard_args)
  /home/burt/ncs/toolchains/7795df4459/usr/local/share/cmake-3.20/Modules/FindPython3.cmake:485 (include)
  /home/burt/ncs/v2.5.0/zephyr/cmake/modules/python.cmake:44 (find_package)
  /home/burt/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  /home/burt/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/burt/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /home/burt/ncs/toolchains/7795df4459/usr/local/bin/cmake -DWEST_PYTHON=/home/burt/ncs/toolchains/7795df4459/usr/local/bin/python3.8 -B/home/burt/ncs/v2.5.0/nrf/applications/asset_tracker_v2/build_nrf9160dk -GNinja -DBOARD=nrf9160dk_nrf9160_ns -S/home/burt/ncs/v2.5.0/nrf/applications/asset_tracker_v2

Note that I highlighted in red above where the incorrect toolchain is selected according to the log output.

This is on Linux. Please help fix this. Thanks.

Regards,

Burt Silverman

Parents
  • Hi Burt,

    I have tested this on Windows 10 and I could not reproduce your issue. Build was successful. The relevant line which you marked red was in my case
    "Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/ncs/toolchains/c57af46cb7/cmake)"
    Here are the steps which I took before successfully building asset_tracker_v2 application: 
    1. download appropriate Toolchain from VS Code, in this case v2.5.0
    2. list all available toolchains ("nrfutil toolchain-manager list") and ensure that v2.5.0 is present in the output.
    3. configure NCS version using "nrfutil toolchain-manager config --ncs-version 2.5.0"
    4. configure Toolchain path by executing "nrfutil toolchain-manager config --toolchain-path C:\ncs\toolchains\c57af46cb7"
    5. start the terminal "nrfutil toolchain-manager install --terminal" (in your case this might be --shell)
    6. in your newly opened terminal window navigate to your asset_tracker_v2 application folder inside NCS v2.5.0 directory 
    7. run "west build -b nrf9160dk_nrf9160_ns -d build_nrf9160" command
    8. observe successful build

    In summary, you might be interested in steps 3, 4, and maybe 1 depending on how you installed toolchain v2.5.0. Since you have Toolchain path problem, it seems that step 4 is especially important in your case.

    Best regards,
    Dejan

  • Hi Dejan,

    I am not able to do your steps 3 and 4 on Linux. Here is some of the output showing versions and then attempts to do those commands.

    burt@T420s:~$ nrfutil --version
    nrfutil 7.13.0 (8289424 2024-07-01)
    commit-hash: 82894242d19ff24a1541712312b3ea3af0ca8f85
    commit-date: 2024-07-01
    host: x86_64-unknown-linux-gnu
    build-timestamp: 2024-07-01T07:32:31.582129656Z
    classification: nrf-external

    burt@T420s:~$ nrfutil toolchain-manager --version
    nrfutil-toolchain-manager 0.15.0 (30dc218 2024-06-12)
    commit-hash: 30dc218a99ce1abd296f9ff5de836eacda2cc474
    commit-date: 2024-06-12
    host: x86_64-unknown-linux-gnu
    build-timestamp: 2024-06-12T14:39:56.492204338Z
    classification: nrf-external

    burt@T420s:~$ nrfutil toolchain-manager config --show
    Install directory: /home/burt/ncs

    burt@T420s:~$ nrfutil toolchain-manager config --ncs-version 2.5.0
    error: unexpected argument '--ncs-version' found

    Usage: nrfutil toolchain-manager config [OPTIONS] <--show|--set <NAME=VALUE>|--unset <NAME>|--restore-default>

    For more information, try '--help'.
    burt@T420s:~$ nrfutil toolchain-manager config --toolchain-path /home/burt/ncs/toolchains/7795df4459
    error: unexpected argument '--toolchain-path' found

    Usage: nrfutil toolchain-manager config [OPTIONS] <--show|--set <NAME=VALUE>|--unset <NAME>|--restore-default>

    For more information, try '--help'.

    I will try this on Windows. Same results.Using --set, the only available variables are install-dir, toolchain-index, keychain-entry, and environment-variable. But on Windows, the correct toolchain is picked and the build proceeds without any issues.

    Please test on Linux. Thanks, Dejan.

    Burt

  • Hi Burt,

    Which specific Linux operating system do you use and which version?

    Best regards,
    Dejan

  • Hi Dejan,

    Ubuntu 24.04.1 LTS. I tried on two machines and got the same result. Note that I have installed v2.5.0 and then v2.7.0 so that the default version (asterisk) starts off as v2.7.0. Then I reinstall v2.5.0 toolchain as per a very old devzone ticket recommendation. That puts the asterisk back at v2.5.0 when listing the toolchains. Then I launch the shell and try to build.

    On one machine I had to symbolically link libunistring.so.5 to libunistring.so.2 in /usr/lib/x86_64-linux-gnu, as recommended by someone in Arch Linux. The other machine had both libunistring2 and libunistring5 packages present so I had fewer issues getting set up.

    Burt

  • Hi Burt,

    Toolchain is not supported on Ubuntu 24.04 as you can see in the list of supporting operating systems. However, it should work if you install tools manually. You can also consider switching to earlier Ubuntu v22.04 LTS.

    Best regards,
    Dejan

Reply Children
  • Thanks, Dejan. I will report my findings here, even though they are based on Ubuntu 24.04.1 LTS. After all, someday the developers will want to make the newer LTS usable, so these findings could be useful.

    If I swtich from using nrfutil to nrfconnect's toolchain manager (graphical) the same issue occurs when I open a terminal at v2.5.0 level. But if I open a v2.7.0 terminal, I can cd to the v2.5.0 directory (for asset_tracker_v2) and do a successful build, but with a few warning messages from compiling C files. Using the v2.7.0 terminal causes the v2.7.0 versions of both toolchain and zephyr to be used.

    On the other hand, if I reinstall v2.7.0 toolchain in nrfutil, then

    • I see the asterisk move to v2.7.0 when I list the toolchains, as expected.
    • Doing a build of v2.5.0 asset_tracker_v2 causes the v2.7.0 toolchain to be used but the v2.5.0 zephyr to be used. No warnings generated from compiling C files.

    I will take a chance that I can accomplish what I need using nrfutil this way. It's hard for me to imagine that the weirdness is due to the OS upgrade rather than something in the nrfutil and nrfconnect applications, but of course anything is possible.

    Burt

  • Okay, I found the problem. It has nothing to do with the version of Ubuntu. I found the problem by trying a build using VS Code, which builds successfully. Then I compared commands. Although the VS Code command line was very long, I was able to find what I could strip away from that and what I could not, when building with nrfutil. Here is the magic command line:

    $ west build -b nrf9160dk_nrf9160_ns -d build_nrf9160dk -- -DNCS_TOOLCHAIN_VERSION=NONE

    So first you use nrfutil toolchain install and nrfutil toolchain list to confirm that the correct toolchain is selected; then in some cases (like when the toolchain is not the newest, from my observations), you need to define the Cmake variable NCS_TOOLCHAIN_VERSION as NONE.

    Is this documented? Is it a bug or just an annoyance?

    If this doesn't work you want to remove the build directory or do a pristine build.

    nRF Connect for Desktop Toolchain Manager is the same but you get to pick the desired toolchain graphically, of course.

    Burt

Related