Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error on esp32 #36

Closed
RomeHein opened this issue Feb 19, 2021 · 3 comments
Closed

Compilation error on esp32 #36

RomeHein opened this issue Feb 19, 2021 · 3 comments

Comments

@RomeHein
Copy link

Hi, I have that compilation error when trying to integrate asyncHTTPRequest to my project for an esp32:

libraries/asyncHTTPrequest/asyncHTTPrequest.cpp.o:(.literal._ZN16asyncHTTPrequest8_connectEv+0x28): undefined reference to `AsyncClient::AsyncClient(tcp_pcb*, tcp_pcb*)'
libraries/asyncHTTPrequest/asyncHTTPrequest.cpp.o:(.literal._ZN16asyncHTTPrequest8_connectEv+0x2c): undefined reference to `AsyncClient::connect(char const*, unsigned short, bool)'
libraries/asyncHTTPrequest/asyncHTTPrequest.cpp.o: In function `asyncHTTPrequest::_connect()':
/Documents/Arduino/libraries/asyncHTTPrequest/src/asyncHTTPrequest.cpp:187: undefined reference to `AsyncClient::AsyncClient(tcp_pcb*, tcp_pcb*)'
/Documents/Arduino/libraries/asyncHTTPrequest/src/asyncHTTPrequest.cpp:187: undefined reference to `AsyncClient::connect(char const*, unsigned short, bool)'

I'm using the AsyncTCP library without any issue as the server running in my project is async. So I don't get why AsyncClient would be undefined. I'm using vscode as IDE.
any help much appreciated :)

@boblemaire
Copy link
Owner

boblemaire commented Feb 19, 2021

For ESP32 the code includes the ESP32 specific ESPAsyncTCP.h. Depending on your IDE, you need to include that in your compile.

I've moved away from this code for ESP32. It works OK but doesn't support https. There is a newer esp32HTTPrequest that is can be substituted. It uses all of the same methods and works the same way, except that it's not asynchronous. It uses the native ESP-IDF HTTP client, which seem to work well. The async capabilities of the older asyncHTTPrequest were needed to get async on the ESP8266, but with the ESP32, you can simply run it in a separate FREErtos task to avoid blocking. Next pass I intend to add some code to allow seamless async by forking a task to do the open and perform, so it will work just like the older asyncHTTPrequest, but also support https.

Caveat-emptor, the new module, while based on the older async code, is not fully tested. It serves my needs reliably but beyond that I'm open to looking at problems others may have, or better to entertain PRs to fix any new issues.

@RomeHein
Copy link
Author

thanks for your very prompt answer.
For the esp32 the AsyncClient would be in AsyncTCP.h library. Which I already include in my sketch:

#include <AsyncTCP.h>
#include <asyncHTTPrequest.h>

and I still get this compilation error.

I was using the native HTTPClient for the esp32 but I kept having this weird issue with it, where any request would send back a "connection refused", even with something as simple as this:

HTTPClient http;
http.begin(client, "http://192.168.1.110:80/test");

Also I'm trying to use as much async code as I can, as the firmware (ESPecial) I'm developing do many different things at the same time. Even with two cores it can get tricky. For instance I use a telegram bot (from this repo: https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot) which is not async, and therefor has to poll telegram server every second or so, then wait for an answer. This block one core on its own... And now I'm adding video streaming 😅

@boblemaire
Copy link
Owner

Closing as stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants