Skip to content

Conversation

prabhu-yu
Copy link

@prabhu-yu prabhu-yu commented Aug 3, 2025

Description

Running ESP-IDF apps in Linux Host is great time saver(please see the link below).
There is ongoing effort for this.
However, when I try to run mqtt on Linux, build fails due to an undefined function.(please see the build output below)
So I have added that function for linux port.
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/host-apps.html

Please suggest improvements to this PR.

Log:

Compilation failure due to undefined function esp_timer_get_time
/usr/bin/ld: esp-idf/mqtt/libmqtt.a(platform_esp32_idf.c.o): in function `platform_tick_get_ms':
/home/p/esp/esp-idf-v5.5/components/mqtt/esp-mqtt/lib/platform_esp32_idf.c:53:(.text.platform_tick_get_ms+0x9): undefined reference to `esp_timer_get_time'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /home/p/gitlab/sw/esp32-cpp/source/build/log/idf_py_stderr_output_3888355 and /home/p/gitlab/sw/esp32-cpp/source/build/log/idf_py_stdout_output_3888355

Related

Testing

Tested on Ubuntu 24.04.2 LTS
I could Build with mqtt and do publish a topic.
Log:

Executing action: all (aliases: build)
Running ninja in directory /home/p/gitlab/sw/esp32-cpp/source/build
Executing "ninja all"...
[1/4] cd /home/p/gitlab/sw/esp32-cpp/sourc...*****************************************"

Run log

Publishing from app running on linux host.

I (89867862) MQTT: Connected to MQTT Broker
I (89867862) MQTT: Subscribed to /device/1/input
I (89867862) MQTT: Publishing to topic: /device/1/output, message: Hello from ESP32
I (89867862) MQTT: return mqtt_event_handler()

Subscribed using mosquitto client.

--> mosquitto_sub -h broker.emqx.io -p 1883  -t  /device/1/output
Hello from ESP32

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@github-actions github-actions bot changed the title MQTT Apps on Linux Host MQTT Apps on Linux Host (IDFGH-16163) Aug 3, 2025
@prabhu-yu
Copy link
Author

Hi @david-cermak ,
May you please review this?

@david-cermak
Copy link
Collaborator

Hi @prabhu-yu

Thanks for checking out the host apps for with MQTT!

We have a host app running this MQTT library here: https://github.com/espressif/esp-protocols/tree/master/examples/mqtt
It just uses some linux-compat components that are not (yet) part of ESP-IDF.

@prabhu-yu
Copy link
Author

Hi @prabhu-yu

Thanks for checking out the host apps for with MQTT!

We have a host app running this MQTT library here: https://github.com/espressif/esp-protocols/tree/master/examples/mqtt It just uses some linux-compat components that are not (yet) part of ESP-IDF.

Noted and Thank you @david-cermak .
(I will remove my PR)

@prabhu-yu prabhu-yu marked this pull request as draft August 17, 2025 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants