Cannot find Zephyr-sdkConfig.cmake

I picked up a project that was last worked on several months ago, updated all the tools, and can't get past this:

[18:25] jwr-macbook-pro:/opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart>west build -b nrf52840_mdk
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: /opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart
-- Using NCS Toolchain 2.1.0 for building. (/opt/nordic/ncs/toolchains/v2.1.0/cmake)
-- Cache files will be written to: /Users/jwr/Library/Caches/zephyr
-- Zephyr version: 3.1.99 (/opt/nordic/ncs/v2.1.0/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf52840_mdk
CMake Error at /opt/nordic/ncs/v2.1.0/zephyr/cmake/modules/verify-toolchain.cmake:84 (find_package):
  Could not find a package configuration file provided by "Zephyr-sdk"
  (requested version 0.13.1) with any of the following names:

    Zephyr-sdkConfig.cmake
    zephyr-sdk-config.cmake

  Add the installation prefix of "Zephyr-sdk" to CMAKE_PREFIX_PATH or set
  "Zephyr-sdk_DIR" to a directory containing one of the above files.  If
  "Zephyr-sdk" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  /opt/nordic/ncs/v2.1.0/zephyr/cmake/modules/zephyr_default.cmake:121 (include)
  /opt/nordic/ncs/v2.1.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /opt/nordic/ncs/v2.1.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
  CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake -DWEST_PYTHON=/opt/homebrew/opt/[email protected]/bin/python3.10 -B/opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart/build -GNinja -S/opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart

I normally use my own checkout of nRF Connect SDK, but this time I even tried using the SDK installed with the toolchain (see above), same results.

I have no idea why this started happening, I never had to point to Zephyr-sdkConfig.cmake. A file with that name does exist in /opt/nordic/ncs/toolchains/v2.1.0/opt/zephyr-sdk/cmake/Zephyr-sdkConfig.cmake, but I have no idea why west is unable to find it.

I have ZEPHYR_BASE=/opt/nordic/ncs/v2.1.0/zephyr and ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb and GNUARMEMB_TOOLCHAIN_PATH=/opt/nordic/ncs/toolchains/v2.1.0.

This is on an Apple Silicon (M1) Mac under Mac OS 12.6.

Any pointers would be appreciated, as I'm completely stuck on this unexpected problem!

  • Hi,

    There were a lot of changes introduces in nRF Connect SDK 2.0.0, including a new toolchain. It seems the issue here is that you have an older project and you are using it with the latest SDK release without migrating it. Depending on the goal, you should either use the nRF Connect SDK release (and accompanying toolchain) your application was built for, or you need to migrate your application to the latest release. The migration notes for nRF Connect SDK v2.0.0 will be particularily relevant here, as it seems your application was for a 1.x release.

  •  — Hmm. I read the migration notes you mentioned, but they do not seem to mention any changes in my project files related to the toolchain used. But in any case, as I've shown in the example above, I reproduced the problem using your "samples/peripheral/lpuart" example, using the toolchain installed with the toolchain manager, in the directory tree which is entirely controlled by the toolchain manager. In other words, while the environment variables might have something to do with the issue, my (old) project is in no way involved in the above example.

    I also did try deleting and reinstalling the toolchain using the toolchain manager, which din't change anything.

  • Hi,

    Ah, I did not notice that you were using the lpuart sample. It also fails if I build for the nrf52840_mdk. That is not a Nordic board though, though it has a Nordic IC. So we do not test that, it is just part of Zephyr. If you try to build the sample for for intsance nrf52840dk_nrf52840, you will see that it build fine.

  • Hmm. Not sure if this is what you mean, but:

    [14:47] jwr-macbook-pro:/opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart>west build -b nrf52840dk_nrf52840 --pristine
    -- west build: making build dir /opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart/build pristine
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart
    -- Using NCS Toolchain 2.1.0 for building. (/opt/nordic/ncs/toolchains/v2.1.0/cmake)
    -- Found Python3: /opt/nordic/ncs/toolchains/v2.1.0/bin/python3 (found suitable exact version "3.9.6") found components: Interpreter
    -- Cache files will be written to: /Users/jwr/Library/Caches/zephyr
    -- Zephyr version: 3.1.99 (/opt/nordic/ncs/v2.1.0/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    CMake Error at /opt/nordic/ncs/v2.1.0/zephyr/cmake/modules/verify-toolchain.cmake:84 (find_package):
    Could not find a package configuration file provided by "Zephyr-sdk"
    (requested version 0.13.1) with any of the following names:

    Zephyr-sdkConfig.cmake
    zephyr-sdk-config.cmake

    Add the installation prefix of "Zephyr-sdk" to CMAKE_PREFIX_PATH or set
    "Zephyr-sdk_DIR" to a directory containing one of the above files. If
    "Zephyr-sdk" provides a separate development package or SDK, be sure it has
    been installed.
    Call Stack (most recent call first):
    /opt/nordic/ncs/v2.1.0/zephyr/cmake/modules/zephyr_default.cmake:121 (include)
    /opt/nordic/ncs/v2.1.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    /opt/nordic/ncs/v2.1.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: /opt/homebrew/bin/cmake -DWEST_PYTHON=/opt/homebrew/opt/[email protected]/bin/python3.10 -B/opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart/build -GNinja -DBOARD=nrf52840dk_nrf52840 -S/opt/nordic/ncs/v2.1.0/nrf/samples/peripheral/lpuart

  • Ah, now I see. Now you are building for nrf52840dk_nrf52840 and that should have worked, and does when I test with SDK v2.1.0 from the toolchain manager on macOS 12.6 building from VS Code. But it seems the environment is not properly set up here. To use the toolchain manger yo would normally open the terminal from within the toolchain manager, and that would set up the environment correctly for you. That does not work in due to a bug in toolchain manger v1.1.3, though.

    Until that is fixed you could either use VS Code with the nRF plugin, which will set up the toolchain automatically as long as you point to the right one, or you could configure the environment manually as you have attempted to do. The way to do this was changed in 2.0.0. We do not have a script that does it for you, but you can see everything you need in /opt/nordic/ncs/toolchains/v2.1.0/environment.json.

    Update: A new release of nRF Connect for Desktop launcher (v3.13.1) for mac is just out now, and that fixes the issue with opening a terminal (and VS Code) from the toolchain manager. If you do that, the example should build as expected from the command line (does so when I test on my M1 MacBook Air).

Related