You can chat about native SDK questions and issues here.

User avatar
#80285 I oriented my project (in terms of overall structure and makefiles) on the example project simple_pair from here: ... r/examples

This is my structure:


I followed this tutorial on how to setup the toolchain (it is in german, I am sorry): ... omment-943

Basically all my ESP8266 toolchain stuff is in:


The compiler stuff is in:


The header files (e.g. osapi.h) are in:


I added all those directories to my PATH-Variable:

echo $PATH

I am in my ESP8266 project folder and I am typing this into my console:

Code: Select alltest@Device:/mnt/c/Users/Standardbenutzer/Documents/ESP8266/ESP8266$ make COMPILE=gcc
make[1]: Entering directory '/mnt/c/Users/Standardbenutzer/Documents/ESP8266/ESP8266/user'
DEPEND: xtensa-lx106-elf-gcc -M -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fdata-sections -fno-builtin-printf -DICACHE_FLASH -DSPI_FLASH_SIZE_MAP=0 -I include -I ../include -I ../include/eagle -I ../driver_lib/include user_main.c
user_main.c:1:19: fatal error: osapi.h: No such file or directory
 #include "osapi.h"
compilation terminated.
make[2]: Entering directory '/mnt/c/Users/Standardbenutzer/Documents/ESP8266/ESP8266/user'
make[2]: *** user: No such file or directory.  Stop.
make[2]: Leaving directory '/mnt/c/Users/Standardbenutzer/Documents/ESP8266/ESP8266/user'
../Makefile:331: recipe for target '.subdirs' failed
make[1]: *** [.subdirs] Error 2
make[1]: Leaving directory '/mnt/c/Users/Standardbenutzer/Documents/ESP8266/ESP8266/user'
Makefile:331: recipe for target '.subdirs' failed
make: *** [.subdirs] Error 2

So why are the header files not found even though I added the path to $PATH?

I also tried this:

Code: Select all`xtensa-lx106-elf-gcc -print-prog-name=cc1` -v
ignoring nonexistent directory "/opt/esp/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/opt/esp/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.

Please help :oops:
User avatar
By quackmore
#80301 what you add to $PATH will be used to find the executables (compiler and linker)

while you have to tell the compiler where the include files are

"osapi.h" is a sdk include so it's located into <your sdk directory>/include

now look at your makefile, search where the include paths are specified and add the missing one

the result should look like this (not exactly like this)
CCFLAGS:= -I$(TOP_DIR)/src/include -I$(SDK_DIR)/include

most likely you will have a similar problem with the linker finding sdk libraries and you will have to change the linker flags too

should be something like this

hope this will help
I've customized my own project structure starting from espressif and nodemcu makefiles so that everytime I create a new project I just have to
1) clone the structure
2) run ./ to generate the project environment
3) run . to setup the environment
and start to code ...
you can have a look at the empty structure here: