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

  • 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