Hello Nordic DevZone,
My name is Ted, and I'm having some difficulty with a recently installed Nordic / Zephyr SDK and toolchain. On 2021-07-24 I downloaded and installed the Zephyr project and Nordics's SDK that's linked from the nRF9160 product overview page. The specific instructions I used are at Nordic site's page "">developer.nordicsemi.com/.../index.html
My need is work related. At present I'm tasked to bring up our nRF9160 dev board and begin writing drivers for additional sensors and memory devices not on this board.
I followed instructions for the "Ubuntu" installation steps, as that's my development environment. I am using the command line, no IDE.
When attempting to build an ARM based blinky demo, the `west` driven build process fails early with the message:
CMake Error at /home/ted/zephyrproject/zephyr/cmake/compiler/gcc/generic.cmake:8 (message):
Zephyr was unable to find the toolchain. Is the environment misconfigured?
I am including full build messages below.
In terms of preparing my workstation and installing dependencies, steps 1 through 4 of "Getting Started" succeed without errors. In particular for step 4, "Install Toolchain" I am able to download and to run the ".run" file for Zephyr SDK version 0.12.4. I first installed this SDK in /opt/zephyr-sdk-0.12.4. Next I attempt to build the ARM based blinky application for the nRF9160 dev board with this command:
$ west build -b [email protected] ./samples/basic/blinky
To this command the following messages appear:
ted@localhost:~/zephyrproject/zephyr$ west build -b [email protected] ./samples/basic/blinky
-- west build: generating a build system
Including boilerplate (Zephyr base (cached)): /home/ted/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/ted/zephyrproject/zephyr/samples/basic/blinky
-- Zephyr version: 2.6.99 (/home/ted/zephyrproject/zephyr), build: zephyr-v2.6.0-1460-g17d2e9d084b2
-- Found west (found suitable version "0.11.0", minimum required is "0.7.1")
-- Board: nrf9160dk_nrf9160, Revision: 1.0.0 (Active: 0.14.0)
-- Cache files will be written to: /home/ted/.cache/zephyr
-- Using toolchain: zephyr 0.12.4 (/opt/zephyr-sdk-0.12.4)
-- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found toolchain: cross-compile (arm-unknown-linux-gnueabi-)
CMake Error at /home/ted/zephyrproject/zephyr/cmake/compiler/gcc/generic.cmake:8 (message):
Zephyr was unable to find the toolchain. Is the environment misconfigured?
User-configuration:
ZEPHYR_TOOLCHAIN_VARIANT: cross-compile
Internal variables:
CROSS_COMPILE: arm-unknown-linux-gnueabi-
TOOLCHAIN_HOME:
Call Stack (most recent call first):
/home/ted/zephyrproject/zephyr/cmake/generic_toolchain.cmake:42 (include)
/home/ted/zephyrproject/zephyr/cmake/app/boilerplate.cmake:570 (include)
/home/ted/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
/home/ted/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/ted/zephyrproject/zephyr/build -S/home/ted/zephyrproject/zephyr/samples/basic/blinky -GNinja
From these messages it looks like there is a variable that's internal to `west` or some other facet of this SDK, namely the variable TOOLCHAIN_HOME. I confirm also that the cmake file indicated above is the source of the fatal error message:
~/zephyrproject/zephyr/cmake/compiler/gcc/generic.cmake
The first few lines of this file are:
1 # SPDX-License-Identifier: Apache-2.0
2
3 set_ifndef(CC gcc)
4
5 find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
6
7 if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND)
8 message(FATAL_ERROR "Zephyr was unable to find the toolchain. Is the environment misconfigured?
9 User-configuration:
10 ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}
11 Internal variables:
12 CROSS_COMPILE: ${CROSS_COMPILE}
13 TOOLCHAIN_HOME: ${TOOLCHAIN_HOME}
14 ")
15 endif()
.
.
.
Line 13 plus the build messages tell me that variable $TOOLCHAIN_HOME is unset. But I don't find any mention of how to set this variable, either semi-permanently as an environment variable (that's not working) or each time manually when invoking the build process.
The nRF9160 SDK / Zephyr Ubuntu set up instructions state that the Zephyr project tools, or meta-tool, can automatically find a given example project's toolchain when the toolchain is installed in /opt or ~, among a few other conventional places. I've installed Zephyr's tools in both these locations, per Nordic's "getting started". Yet the internal variable $TOOLCHAIN_HOME is unset and seems to be the reason that the simplest of demos is failing to start compiling.
I have found only a couple other posts on any forum with this error message, and the solutions in those were not related or did not solve the issue for me on my workstation.
Are there any further debugging steps I can take? Or command line options I can pass to set $TOOLCHAIN_HOME and allow the nRF9160 Zephyr projects from NordicSemi to build?
Lastly am I correct to say that, in my scenario, $TOOLCHAIN_HOME can and should be set to /opt/zephyr-sdk-0.12.4?
Thank you in advance!
- Ted