No such file or directory “Wifi.h and WiFiClientSecure.h” with Chain+

See original GitHub issue

Configuration

Operating system: Windows 10

PlatformIO Version tested with both 5.1.1a3 and the latest stable version (not sure which one it is at the moment because I updated before checking my previous version).

Description of problem

I am trying to add WebSocket to my ESP32 project, but unfortunately the compiler fails as soon set lib_ldf_mode to chain+. I believe this used to work in my ESP8266 projects. Following is the error message I get:


Indexing .pio\build\esp32_dev\libc94\libArduinoJson.a Compiling .pio\build\esp32_dev\lib748\FS\FS.cpp.o Compiling .pio\build\esp32_dev\lib748\FS\vfs_api.cpp.o In file included from .pio/libdeps/esp32_dev/WebSockets/src/WebSocketsClient.h:28:0, from include/websocket/websocket_client.hpp:3, from src/websocket_client.cpp:1: .pio/libdeps/esp32_dev/WebSockets/src/WebSockets.h:190:30: fatal error: WiFiClientSecure.h: No such file or directory …
.pio/libdeps/esp32_dev/WebSockets/src/WebSockets.h:189:18: fatal error: WiFi.h: No such file or directory

Below is my platformio.ini (the important part):

[env:esp32_dev]
framework = arduino
platform = espressif32
board = esp32dev
platform_packages = 
	; Uses new tool chain with a non-released Arduino package to be able to compile with C++17 (C++17 may become the default in the future, therefore this may be soon not necessary).
	toolchain-xtensa@~5.100200.0
	framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
build_unflags =
	-std=c++11
	-fno-exceptions ; Removes the default exceptions disabling flag.
build_flags =
	-std=c++17
lib_ldf_mode = chain+
lib_deps =
        ...
        ; Here I am using the not-released version, because I need a fix for ESP32.
	https://github.com/Links2004/arduinoWebSockets.git#ed685e551f9a1a992037f5fdc791a36c4c43abc0

The problem seems now to occur only when adding arduinoWebSocket library, nevertheless this seems to be a PlatoformIO bug. Could you check that please?

Actual Results

Project does not compile with errors shown above when setting lib_ldf_mode to chain+.

Expected Results

Project should compile even after setting lib_ldf_mode to chain+.

If problems with PlatformIO Build System:

Source file to reproduce issue:

I can reproduce the problem even without even adding and specific code, only by referencing the arduinoWebSocket library. So defining a new variable of type WebSocketsClient in the main.cpp file should be more than enough.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
valeroscommented, Mar 16, 2021

Hi @MohammedNoureldin ! For some reason LDF fails to resolve dependencies in the WebSockets header in the + modes. Apparently, the easiest way is not to use + at all, but if you want to keep the chain+ mode for the rest of your project then it gets a bit tricky. At the moment I see here only one possible workaround - modify the library.json file for the WebSockets library. You can either fork the library and specify a new link in your platformio.ini or clone it directly to your lib folder, but in both cases you need to manually change the LDF mode to chain:

{
    ...
    "version": "2.3.6",
    "build": {
        "libLDFMode": "chain"
    }
   ...
}

Sorry for the inconvenience.

1reaction
ivankravetscommented, Mar 16, 2021

We reproduced this issue, thanks! There is no ETA when we will investigate and fix it.

@valeros will back with a temporary solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No such file or directory "Wifi.h and WiFiClientSecure ... - GitHub
No such file or directory "Wifi.h and WiFiClientSecure.h" with ESP32, ... Uses new tool chain with a non-released Arduino package to be able...
Read more >
Anybody able to successfully compile Azure SDK ESP32-dev ...
I have been able to compile and run using Arduino IDE but not ... it expecting a specific version of Wifi.h and WiFiClientSecure.h....
Read more >
arduinoWebSockets - Bountysource
Hope I explained in not too messy way, thanks for help . ... No such file or directory "Wifi.h and WiFiClientSecure.h" with ESP32,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found