Skip to content

async-mqtt-client compiled and linked in when WLED_DISABLE_MQTT is set #4648

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

Open
1 task done
rhkean opened this issue Apr 17, 2025 · 2 comments
Open
1 task done

async-mqtt-client compiled and linked in when WLED_DISABLE_MQTT is set #4648

rhkean opened this issue Apr 17, 2025 · 2 comments
Labels
bug confirmed The bug is reproducable and confirmed help wanted

Comments

@rhkean
Copy link

rhkean commented Apr 17, 2025

What happened?

I just noticed that the async-mqtt-client is compiled and linked into the bin even when the WLED_DISABLE_MQTT flag is set.

by deleting the entire folder from the src/dependencies folder, the bin file is 3.2k smaller

To Reproduce Bug

add -D WLED_DISABLE_MQTT flag to platformio.ini file
build the project
notice that the async-mqtt-client is still listed as being compile and linked

delete the async-mqtt-client folder from the src/dependencies folder
see that the bin is 3200 bytes smaller

Expected Behavior

async-mqtt-client is not linked and/or included in the .bin file

Install Method

Self-Compiled

What version of WLED?

WLED 0.15.1.beta2

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@rhkean rhkean added the bug label Apr 17, 2025
@blazoncek blazoncek added help wanted confirmed The bug is reproducable and confirmed labels Apr 28, 2025
@blazoncek
Copy link
Collaborator

@willmmiles could you take a look what's causing it? I peeked into ELF and can see some AsyncMqttClient references but can't make anything useful from it.

@willmmiles
Copy link
Member

@willmmiles could you take a look what's causing it? I peeked into ELF and can see some AsyncMqttClient references but can't make anything useful from it.

The linker always includes .cpp files that are part of the project itself -- only those in static libraries are filtered based on whether or not there are external references. The assumption is that you could have important work being done in static constructors, for example.

IMO the best fix is to un-vendor the library, and call upon the latest version from upstream via lib_deps; I'm pretty sure there's been quite a few fixes since it was vendored in here ...

The second-best fix is to move it to the "lib" folder, import a proper library.json (ideally from the upstream project), and add it to lib_deps.

Giving the dependencies some love is next on my list after usermod wrangling. I've still got that old ArduinoJSON v7 branch kicking around, too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed The bug is reproducable and confirmed help wanted
Projects
None yet
Development

No branches or pull requests

3 participants