No such file or directory “Wifi.h and WiFiClientSecure.h” with Chain+
See original GitHub issueConfiguration
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:
- Created 3 years ago
- Reactions:1
- Comments:17 (8 by maintainers)
Top Related StackOverflow Question
Hi @MohammedNoureldin ! For some reason LDF fails to resolve dependencies in the
WebSocketsheader in the+modes. Apparently, the easiest way is not to use+at all, but if you want to keep thechain+mode for the rest of your project then it gets a bit tricky. At the moment I see here only one possible workaround - modify thelibrary.jsonfile for theWebSocketslibrary. You can either fork the library and specify a new link in yourplatformio.inior clone it directly to yourlibfolder, but in both cases you need to manually change the LDF mode tochain:Sorry for the inconvenience.
We reproduced this issue, thanks! There is no ETA when we will investigate and fix it.
@valeros will back with a temporary solution.