This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf9160 build problem (fatal error: dt-bindings/i2c/i2c.h: No such file or directory)

UPDATES after original posting:

I now remember having the same problem described below, once before on my windows installation.
At that time I decided to switch and reinstall everything in a virtual Ubuntu dedicated only to this project,
meaning that I never solved the original problem !!

I have now found the problem and it it turns out that several folder in the zephyr/include was empty (including the dt-bindings/*.*).
After a git restore everything works fine !!

Now I'm sitting back wondering if some of the scripts causes this problem in rare situations !! ?? 

/Jesper

-------------------------------

I'm  suddenly unable til build any of my nrf9160 project and I have no idea what is wrong !!

I switch and tried build a simple hello-world that used to work but gets the same build error as listed below.

And if i try to load/build the same from SES , it the same.

I have seen problems when using west 0.7.0 and have manually switch to use 0.6.3

$ cmake -B build -GNinja  -DBOARD=nrf9160_pca20035ns
$  west build -t menuconfig
$ west build -p auto -b nrf9160_pca20035ns
$ west build

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ west build
-- west build: build configuration:
source directory: /home/jesper/Desktop/Projects/nordic/ncs/nrf/samples/icarus/hello_world
build directory: /home/jesper/Desktop/Projects/nordic/ncs/nrf/samples/icarus/hello_world/build (created)
BOARD: nrf9160_pca20035ns (origin: configfile)
-- west build: generating a build system
-- Zephyr version: 2.1.99
-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.9", minimum required is "3.6")
-- Selected BOARD nrf9160_pca20035ns
-- Found west: /home/jesper/.local/bin/west (found suitable version "0.6.3", minimum required is "0.6.0")
-- Loading /home/jesper/Desktop/Projects/nordic/ncs/nrf/boards/arm/nrf9160_pca20035/nrf9160_pca20035ns.dts as base
In file included from /home/jesper/Desktop/Projects/nordic/ncs/zephyr/dts/arm/nordic/nrf9160ns_sica.dtsi:8,
from /home/jesper/Desktop/Projects/nordic/ncs/nrf/boards/arm/nrf9160_pca20035/nrf9160_pca20035ns.dts:8,
from <command-line>:
/home/jesper/Desktop/Projects/nordic/ncs/zephyr/dts/arm/nordic/nrf9160ns.dtsi:8:10: fatal error: dt-bindings/i2c/i2c.h: No such file or directory
8 | #include <dt-bindings/i2c/i2c.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMake Error at /home/jesper/Desktop/Projects/nordic/ncs/zephyr/cmake/dts.cmake:140 (message):
command failed with return code: 1
Call Stack (most recent call first):
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Building twice (without deleting build folder) gives this 

Fullscreen
1
2
3
4
5
6
7
$ west build
-- west build: build configuration:
source directory: /home/jesper/Desktop/Projects/icarus/hello_world
build directory: /home/jesper/Desktop/Projects/nordic/ncs/nrf/samples/icarus/hello_world/build
BOARD: nrf9160_pca20035ns (origin: CMakeCache.txt)
-- west build: building application
Error: could not find CMAKE_PROJECT_NAME in Cache
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

main.c

Fullscreen
1
2
3
4
5
6
7
8
9
10
#include <zephyr.h>
#include <kernel_structs.h>
#include <sys/printk.h>
#include <stdio.h>
void main(void)
{
printf("Hello World\n");
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

prj.conf

Fullscreen
1
2
# General config
CONFIG_ASSERT=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

.west/config

Fullscreen
1
2
3
4
[manifest]
path = nrf
[build]
board = nrf9160_pca20035ns
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX