PlatformIO Community

WebSockets can't find ESP8266WiFi

Hi all,

I’ve been scouring the forums and Google trying to figure this out for about 2 days. I’m relatively new to everything, so forgive me if I am missing something. I’ve had some issues in my primary project, so I created a new workspace to test things out. It’s still giving me the same error: ESP8266WiFi.h: No such file or directory. The issue has something to do with switching lib_ldf_mode to deep+, which is something I am experimenting with in my primary project.

Here is my main.cpp:

#include <Arduino.h>
#include <ESP8266WiFi.h>

#include "WebSocketsServer.h"

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:

Here is my platformio.ini:

lib_ldf_mode = deep+

platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = 549

And here is the build output:

    Verbose mode can be enabled via `-v, --verbose` option
    PLATFORM: Espressif 8266 2.2.2 > NodeMCU 1.0 (ESP-12E Module)
    HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
    PACKAGES: toolchain-xtensa 2.40802.190218 (4.8.2), framework-arduinoespressif8266 2.20502.0 (2.5.2), tool-esptool 1.413.0 (4.13), tool-esptoolpy 1.20600.0 (2.6.0)
    LDF: Library Dependency Finder ->
    LDF Modes: Finder ~ deep+, Compatibility ~ soft
    Found 30 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- <WebSockets> 2.2.0
    |   |-- <Hash> 1.0
    |-- <ESP8266WiFi> 1.0
    Compiling .pio\build\nodemcuv2\lib2e7\WebSockets_ID549\SocketIOclient.cpp.o
    Compiling .pio\build\nodemcuv2\lib2e7\WebSockets_ID549\WebSockets.cpp.o
    Compiling .pio\build\nodemcuv2\lib2e7\WebSockets_ID549\WebSocketsClient.cpp.o
    Compiling .pio\build\nodemcuv2\lib2e7\WebSockets_ID549\WebSocketsServer.cpp.o
    In file included from .pio\libdeps\nodemcuv2\WebSockets_ID549\src\WebSocketsClient.cpp:25:0:
    .pio\libdeps\nodemcuv2\WebSockets_ID549\src\WebSockets.h:137:25: fatal error: ESP8266WiFi.h: No such file or directory

I don’t really understand the problem, but I thought I would put it out there in case anyone else has a similar issue or wants to look into it. Thanks in advance for any input.


Can you edit your post and enclose the code and the output in triple backquotes? Currently, the display is corrupted (see dependency graph).

1 Like

I can confirm it is specific to the + LDF modes - both chain+ and deep+ fail.

With the above skeleton main.cpp, and the following platformio.ini

platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = 549


lib_ldf_mode = chain

lib_ldf_mode = chain+

lib_ldf_mode = deep

lib_ldf_mode = deep+

… I get …

Environment            Status    Duration
---------------------  --------  ------------
nodemcuv2-ldf_default  SUCCESS   00:00:22.669
nodemcuv2-ldf_chain    SUCCESS   00:00:23.018
nodemcuv2-ldf_chain+   FAILED    00:00:02.163
nodemcuv2-ldf_deep     SUCCESS   00:00:21.971
nodemcuv2-ldf_deep+    FAILED    00:00:02.161

The failure makes no sense as it’s a ‘simple’ test compared to some of the earlier ones - and it’s not a complex conditional. Plus ESP8266WiFi does appears to be in the include path. :confused:


Any idea where I should take the issue from here? I’m interested in understanding why it’s failing. Thanks for confirming!

Avoid the plus variants? :laughing: Nope, sorry, no idea… that’s a problem for @ivankravets when he gets a chance… or anyone else who know how the LDF processing works. It’ll be this file doing all the heavy lifting… but it’s making my head hurt looking at it… :confounded:

1 Like

Oh, strange issue. LDF is currently a little bit complicated. The current version uses virtual pre-processing based on Python. There is a new prototype of LDF v2.0 which will be based on native compiler pre-processing but with careful using of system resources. The normal way is to do the same what C/C++ Preprocessor does on ever file to get a clear picture about runtime macros and “includes”. If we will do this from LDF side, the compilation time will increase in the proportion of the number of files used by project and libraries.

I’ll back soon here with some updates if we have a working branch with new LDF. The core idea is to drop these options from lib_ldf_mode and have deep+ by default. Or, maybe off, chain+, deep+, where chain+ could be a default value.

1 Like