Can't find include files

I’m trying to build a program for a Adafruit ESP32 feather. I have run some examples successfully but now I’m trying to compile in come other code I have and the compiler is not able to file some basic include files like string.h. I turned on verbosity and see the errors:

ignoring nonexistent directory “C:/Users/dseltz/.platformio/platforms/espressif32/builder/Â C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos”

I’m trying to specify my include directories in my platformio.ini file this way:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
build_flags =
    -DOSAPI_OS_DEF_H=\"osapi_os_freertos.h\"
    -DUDP_EXCLUDE_BUILTIN
    -TARGET="armFreeRTOSgcc"
    -I C:\Users\dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos
    -I C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/newlib
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/osapi
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/domain
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/infrastructure
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/publication
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/subscription
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/topic
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/type

What am I doing wrong?

I’m using Visual Studio Code with the Platformio extension.

Here is the error line:

C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/FreeRTOS.h:11:18: fatal error: string: No such file or directory

Sounds like the line #include <string> causes an error. Well, FreeRTOS has C codebase, and string is a C++ standard header, so that error seems to strange to me. Where I can find that “MicroESP32Freertos” library for inspection?

1 Like

Hi maxgerhardt,
The code base is DDS and I’ll see if I can make it available. It has already been run many times with Freertos when built with other platforms (not with a arduino platform yet). But I’ll check to see if maybe that is a problem.

Thanks for the help.

Dave

But what I don’t understand is:

  1. Why is it looking for FreeRTOS.h in the directory: C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/FreeRTOS.h. It is not in my include list.

  2. Why am I getting the message: "ignoring nonexistent directory “C:/Users/dseltz/.platformio/platforms/espressif32/builder/Â C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos”

But it’s autodetected by the library dependency finder since it actually has a FreeRTOS.h and also C++ wrappers for it: arduino-esp32/libraries/BLE/src at master · espressif/arduino-esp32 · GitHub. There’s also the #include <string> (here), whic happens in C++ code, so that’s actually ok and the compiler should find it…

You should attempt to ignore that library by doing lib_ignore = BLE for the time being.

Why are you specifically including this SDK include path here?

Please also note that just including the include directory of the library will not actually build source code of it. You should include the FreeRTOS code differently, e.g. by the means of a library.

Then you also have to take care that the FreeRTOS V8.2.0, which is built into Arduino-ESP32, somehow isn’t built. (see arduino-esp32/tools/sdk/include/freertos/freertos at 1efcd21ba91c08e702a0c6e47e00a2d0a8c06b84 · espressif/arduino-esp32 · GitHub). I see this as a rather difficult task, since this FreeRTOS also has plenty of modifications to support the dual-core nature of the chip (https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/freertos-smp.html) and other parts of the Arduino SDK are intertwined with it.

Maybe you want to start from scratch with like a baremetal framework?

Also did you mean -DTARGET=.." hereAnd Whyarm` as the target for an ESP32 / XTensa32 core?

So this folder 100% exists when you paste the path into an explorer?

HI maxgerhardt,
This is a great help. I don’t want to build any freertos code. I just need to run on top of it and need access to freertos.h which is references from my code.

I did try to add lib_ignore = BLE and remove two of the include paths:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
lib_ignore = BLE
build_flags =
    -DOSAPI_OS_DEF_H=\"osapi_os_freertos.h\"
    -DUDP_EXCLUDE_BUILTIN
    -TARGET="armFreeRTOSgcc"
    -I C:\Users\dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos
;    -I C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/newlib
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/osapi
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/domain
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/infrastructure
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/publication
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/subscription
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/topic
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/type

but I still get:

*GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072*
*Compiler executable checksum: f8c150667b22ef24be0575fd93addc63*
*In file included from include/osapi/osapi_os_freertos.h:30:0,*
*                 from include/osapi/osapi_os.h:43,*
*                 from include/osapi/osapi_config.h:109,*
*                 from include/osapi/osapi_types.h:34,*
*                 from include/cdr/cdr_stream.h:36,*
*                 from src\cdr\stream\md5.c:111:*
*C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/FreeRTOS.h:11:18: fatal error: string: No such file or directory*

This points to: #include "<string>"

And yes the path: C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos exists.

Hi @maxgerhardt I have created a small reproducer that I can share if you have time to look at it. How would I share it?

You could use github or a google drive upload, for example.

Here is the example PlatformIO project: ESP32 – Google Drive

Thanks for the help

I still have this problem and have not been able to figure out how to make that one include file is scanned and not another. The error is:

Compiling .pio\build\featheresp32\src\db\urtdb\DBUrtdb.c.o
In file included from include/osapi/osapi_os_freertos.h:30:0,
from include/osapi/osapi_os.h:43,
from include/osapi/osapi_config.h:109,
from src\db\urtdb\DBUrtdb.c:52:
C:\Users\dseltz.platformio\packages\framework-arduinoespressif32\libraries\BLE\src/FreeRTOS.h:11:18: fatal error: string: No such file or directory

I have my own version of FreeRTOS.h I want to use but it keeps pointing at C:\Users\dseltz.platformio\packages\framework-arduinoespressif32\libraries\BLE\src/FreeRTOS.h.

My version of FreeRTOS.h is in the directory include/freertos which you can see is listed as one of the -I directories:

COLLECT_GCC_OPTIONS=’-o’ ‘.pio\build\featheresp32\lib288\BLE\BLEAdvertising.cpp.o’ ‘-c’ ‘-fno-rtti’ ‘-std=gnu++11’ ‘-T’ ‘ARGET=armFreeRTOSgcc’ ‘-v’ ‘-Os’ ‘-g3’ ‘-Wall’ ‘-nostdlib’ ‘-Wpointer-arith’ ‘-Wno-error=unused-but-set-variable’ ‘-Wno-error=unused-variable’ ‘-mlongcalls’ ‘-ffunction-sections’ ‘-fdata-sections’ ‘-fstrict-volatile-bitfields’ ‘-Wno-error=deprecated-declarations’ ‘-Wno-error=unused-function’ ‘-Wno-unused-parameter’ ‘-Wno-sign-compare’ ‘-fstack-protector’ ‘-fexceptions’ ‘-Werror=reorder’ ‘-D’ ‘PLATFORMIO=40100’ ‘-D’ ‘ARDUINO_FEATHER_ESP32’ ‘-D’ ‘OSAPI_OS_DEF_H=“osapi_os_freertos.h”’ ‘-D’ ‘UDP_EXCLUDE_BUILTIN’ ‘-D’ ‘ESP32’ ‘-D’ ‘ESP_PLATFORM’ ‘-D’ ‘F_CPU=240000000L’ ‘-D’ ‘HAVE_CONFIG_H’ ‘-D’ ‘MBEDTLS_CONFIG_FILE=“mbedtls/esp_config.h”’ ‘-D’ ‘ARDUINO=10805’ ‘-D’ ‘ARDUINO_ARCH_ESP32’ ‘-D’ ‘ARDUINO_VARIANT=“feather_esp32”’ ‘-D’ ‘ARDUINO_BOARD=“Adafruit ESP32 Feather”’ ‘-I’
‘C:\Users\dseltz.platformio\packages\framework-arduinoespressif32\libraries\BLE\src’ ‘-I’ ‘include’ ‘-I’ ‘include\freertos’ ‘-I’ ‘include\osapi’

I am including: lib_ignore = BLE in my platformio file.