-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ArduinoOTA undefined reference (MDNS) when compiling with -DNO_GLOBAL_INSTANCES #4643
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
Comments
The new MDNS has a close() method. Also, I think the lines of code that make use of MDNS could be conditionally compiled with the same macros. |
Thx! I have just checked out the new mDNS implementation and have two minor issues with it.
|
Hmmm. The new mDNS implementation does not work at all here. Switching from |
@everslick, if you're still stuck with the legacy MDNS responder, I think it would be very helpful to open a bug with the new issue so it can be tracked and fixed. We're looking to deprecate the legacy responder and fixes are probably not going to be prioritized very high. |
I will check, if I have still this problem with latest master tomorrow and report back! |
Please make sure, that you've got a call to MDNS::update() (or at least OTA::update()) in the loop. |
I think this has to do with the global MDNS instance being manipulated from ArduinoOTA. Those lines of code would need to be conditionally compiled to avoid this error. |
I think we are mixen two different issues here. The original issue was the dependency of ArduinoOTA on MDNS, which breaks the build when GLOBAL_INSTANCES is disabled. which can be fixed by using the same #ifdefs for those lines as already pointed out by @devyte. The other issue is, that the new mDNS implementation did not work for me, when I tried it. But I have to admit, that I did not add MDNS.update(), because the old one didn't need it, and I somehow missed it. Anyway, I will retest the new mDNS ASAP, and report back. |
Propose PR: #5768 |
Fixes #4643 This is especially important when compiling for host mode, because ArduinoOTA is pulled in unconditionally by the Makefile in tests/host. Thus it breaks the build as soon as NO_GLOBAL_INSTANCES or NO_GLOBAL_MDNS is defined.
The ArduinoOTA library has an hidden dependency on mDNS. When we have NO_GLOBAL_INSTANCES defined there will be no global object with the name MDNS and the compile fails.
IMHO the two libraries should work independently. I suspect just removing the MDNS call from ArduinoOTA will be met with some resistance, though.
I don't know how this could be easily fixed, besides removing the
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
guard in ESP8266mDNS.h, which is a bit ironic, because I was the one proposing it in the first place. And for the sake of RAM usage, I still think it is a good thing to be be able to start services on demand, instead of creating a bunch of global objects regardless of if they are needed.
On ESP32 the MDNS object is also global, but at least there is a MDNS.end() method to shut the server and free all allocated memory.
Any opinions on that?
The text was updated successfully, but these errors were encountered: