bertmelis / espMqttClient

MQTT 3.1.1 client library for the Espressif devices ESP8266 and ESP32 on the Arduino framework.
https://www.emelis.net/espMqttClient/
MIT License
92 stars 21 forks source link

[BUG]Could not build using ESP IDF #128

Closed dzungpv closed 6 months ago

dzungpv commented 6 months ago

I migrate from https://github.com/marvinroger/async-mqtt-client but espMqttClient could not build with ESP IDF. You can see the change I make to support ESP IDF here: https://github.com/dzungpv/espMqttClient To build Arduino project in ESP IDF following the steps: https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/esp-idf_component.html It show error with String.h, I rename it to StringUtil.h but still not success.

bertmelis commented 6 months ago

Could you copy/paste the build log here?

From the bug report template:

Which platform, esp8266 or esp32? Do you use TLS or not? Do you use an IDE (Arduino, Platformio...)? Which version of the Arduino framework?

Please include any debug output and/or decoded stack trace if applicable.

dzungpv commented 6 months ago

I fixed it, but I see you support linux in the code? I rename the String class to StringUtil and remove IPAddress, and it will build. Because ESP IDF will show error with duplicate class file, you can see what I change here: https://github.com/dzungpv/espMqttClient/commits/main/

dzungpv commented 6 months ago

This is the log relate to IPAddress:

[1198/1221] Building CXX object esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/espMqttClientAsync.cpp.obj
FAILED: esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/espMqttClientAsync.cpp.obj 
/Users/vietdzung/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -DESP32 -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/build/config -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Packets -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/newlib/platform_include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/include/esp_additions/freertos -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/port/xtensa/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/include/esp_additions -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/include/soc -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/include/soc/esp32 -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/port/esp32/. -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/port/esp32/private_include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/heap/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/log/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/include/apps -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/include/apps/sntp -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/lwip/src/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/port/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/port/esp32/include/arch -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/soc/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/soc/esp32/. -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/soc/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/hal/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/hal/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/hal/platform_port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_rom/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_rom/include/esp32 -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_rom/esp32 -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_common/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_system/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_system/port/soc -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_system/port/public_compat -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/xtensa/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/xtensa/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/driver/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/driver/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_pm/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_ringbuf/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/efuse/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/efuse/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/vfs/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_wifi/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_event/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_netif/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_eth/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/tcpip_adapter/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_phy/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_phy/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_ipc/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/app_trace/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_timer/include -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/variants/esp32 -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/cores/esp32 -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/ArduinoOTA/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/AsyncUDP/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/BLE/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/BluetoothSerial/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/DNSServer/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/EEPROM/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/ESP32/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/ESPmDNS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Ethernet/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/FFat/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/FS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/HTTPClient/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/HTTPUpdate/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/LittleFS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Insights/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/I2S/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/NetBIOS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Preferences/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/RainMaker/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SD_MMC/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SD/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SimpleBLE/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SPIFFS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SPI/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Ticker/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Update/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/USB/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WebServer/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WiFiClientSecure/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WiFi/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WiFiProv/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Wire/src -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/spi_flash/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mbedtls/port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mbedtls/mbedtls/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mbedtls/esp_crt_bundle/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mdns/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/console -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_adc_cal/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wifi_provisioning/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/protocomm/include/common -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/protocomm/include/security -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/protocomm/include/transports -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/nvs_flash/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/nghttp/port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/nghttp/nghttp2/lib/includes -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wpa_supplicant/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wpa_supplicant/port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wpa_supplicant/esp_supplicant/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_https_ota/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_http_client/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/bootloader_support/include -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src -mlongcalls -Wno-frame-address  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -fmacro-prefix-map=/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT=. -fmacro-prefix-map=/Users/vietdzung/esp/esp-idf-v4.4.6=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu++11 -fno-exceptions -fno-rtti -D_GNU_SOURCE -DIDF_VER=\"v4.4.6-5-g98a1ea898c-dirty\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -DARDUINO=10812 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD=\"ESP32_DEV\" -DARDUINO_VARIANT=\"esp32\" -DESP32 -MD -MT esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/espMqttClientAsync.cpp.obj -MF esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/espMqttClientAsync.cpp.obj.d -o esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/espMqttClientAsync.cpp.obj -c /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/espMqttClientAsync.cpp
In file included from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.h:15,
                 from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/espMqttClientAsync.h:16,
                 from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/espMqttClientAsync.cpp:11:
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:82:18: error: 'IPAddress' has not been declared
     bool connect(IPAddress ip, uint16_t port);
                  ^~~~~~~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:122:5: error: 'IPAddress' does not name a type; did you mean 'IPAddress_h'?
     IPAddress remoteIP();
     ^~~~~~~~~
     IPAddress_h
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:124:5: error: 'IPAddress' does not name a type; did you mean 'IPAddress_h'?
     IPAddress localIP();
     ^~~~~~~~~
     IPAddress_h
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:204:26: error: expected ')' before 'addr'
     AsyncServer(IPAddress addr, uint16_t port);
                ~         ^~~~~
                          )
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:220:5: error: 'IPAddress' does not name a type; did you mean 'IPAddress_h'?
     IPAddress _addr;
     ^~~~~~~~~
     IPAddress_h
In file included from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.h:20,
                 from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/espMqttClientAsync.h:16,
                 from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/espMqttClientAsync.cpp:11:
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/Transport.h:19:24: error: 'IPAddress' has not been declared
   virtual bool connect(IPAddress ip, uint16_t port) = 0;
                        ^~~~~~~~~
In file included from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/espMqttClientAsync.h:16,
                 from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/espMqttClientAsync.cpp:11:
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.h:29:16: error: 'IPAddress' has not been declared
   bool connect(IPAddress ip, uint16_t port) override;
                ^~~~~~~~~
[1206/1221] Building CXX object esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/Transport/ClientAsync.cpp.obj
FAILED: esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/Transport/ClientAsync.cpp.obj 
/Users/vietdzung/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -DESP32 -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/build/config -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Packets -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/newlib/platform_include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/include/esp_additions/freertos -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/port/xtensa/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/freertos/include/esp_additions -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/include/soc -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/include/soc/esp32 -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/port/esp32/. -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_hw_support/port/esp32/private_include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/heap/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/log/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/include/apps -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/include/apps/sntp -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/lwip/src/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/port/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/lwip/port/esp32/include/arch -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/soc/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/soc/esp32/. -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/soc/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/hal/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/hal/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/hal/platform_port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_rom/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_rom/include/esp32 -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_rom/esp32 -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_common/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_system/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_system/port/soc -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_system/port/public_compat -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/xtensa/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/xtensa/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/driver/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/driver/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_pm/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_ringbuf/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/efuse/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/efuse/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/vfs/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_wifi/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_event/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_netif/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_eth/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/tcpip_adapter/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_phy/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_phy/esp32/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_ipc/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/app_trace/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_timer/include -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/variants/esp32 -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/cores/esp32 -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/ArduinoOTA/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/AsyncUDP/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/BLE/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/BluetoothSerial/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/DNSServer/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/EEPROM/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/ESP32/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/ESPmDNS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Ethernet/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/FFat/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/FS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/HTTPClient/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/HTTPUpdate/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/LittleFS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Insights/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/I2S/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/NetBIOS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Preferences/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/RainMaker/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SD_MMC/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SD/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SimpleBLE/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SPIFFS/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/SPI/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Ticker/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Update/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/USB/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WebServer/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WiFiClientSecure/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WiFi/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/WiFiProv/src -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/arduino-esp32/libraries/Wire/src -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/spi_flash/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mbedtls/port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mbedtls/mbedtls/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mbedtls/esp_crt_bundle/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/mdns/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/console -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_adc_cal/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wifi_provisioning/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/protocomm/include/common -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/protocomm/include/security -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/protocomm/include/transports -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/nvs_flash/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/nghttp/port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/nghttp/nghttp2/lib/includes -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wpa_supplicant/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wpa_supplicant/port/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/wpa_supplicant/esp_supplicant/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_https_ota/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/esp_http_client/include -I/Users/vietdzung/esp/esp-idf-v4.4.6/components/bootloader_support/include -I/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src -mlongcalls -Wno-frame-address  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -fmacro-prefix-map=/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT=. -fmacro-prefix-map=/Users/vietdzung/esp/esp-idf-v4.4.6=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu++11 -fno-exceptions -fno-rtti -D_GNU_SOURCE -DIDF_VER=\"v4.4.6-5-g98a1ea898c-dirty\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -DARDUINO=10812 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD=\"ESP32_DEV\" -DARDUINO_VARIANT=\"esp32\" -DESP32 -MD -MT esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/Transport/ClientAsync.cpp.obj -MF esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/Transport/ClientAsync.cpp.obj.d -o esp-idf/espMqttClient/CMakeFiles/__idf_espMqttClient.dir/src/Transport/ClientAsync.cpp.obj -c /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp
In file included from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.h:15,
                 from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:11:
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:82:18: error: 'IPAddress' has not been declared
     bool connect(IPAddress ip, uint16_t port);
                  ^~~~~~~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:122:5: error: 'IPAddress' does not name a type
     IPAddress remoteIP();
     ^~~~~~~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:124:5: error: 'IPAddress' does not name a type
     IPAddress localIP();
     ^~~~~~~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:204:26: error: expected ')' before 'addr'
     AsyncServer(IPAddress addr, uint16_t port);
                ~         ^~~~~
                          )
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/AsyncTCP/src/AsyncTCP.h:220:5: error: 'IPAddress' does not name a type
     IPAddress _addr;
     ^~~~~~~~~
In file included from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.h:20,
                 from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:11:
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/Transport.h:19:24: error: 'IPAddress' has not been declared
   virtual bool connect(IPAddress ip, uint16_t port) = 0;
                        ^~~~~~~~~
In file included from /Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:11:
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.h:29:16: error: 'IPAddress' has not been declared
   bool connect(IPAddress ip, uint16_t port) override;
                ^~~~~~~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:22:27: error: 'bool espMqttClientInternals::ClientAsync::connect' is not a static data member of 'class espMqttClientInternals::ClientAsync'
 bool ClientAsync::connect(IPAddress ip, uint16_t port) {
                           ^~~~~~~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:22:27: error: 'IPAddress' was not declared in this scope
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:22:50: error: expected primary-expression before 'port'
 bool ClientAsync::connect(IPAddress ip, uint16_t port) {
                                                  ^~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:22:54: error: expression list treated as compound expression in initializer [-fpermissive]
 bool ClientAsync::connect(IPAddress ip, uint16_t port) {
                                                      ^
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp: In member function 'virtual int espMqttClientInternals::ClientAsync::read(uint8_t*, size_t)':
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:36:3: error: 'memcpy' was not declared in this scope
   memcpy(buf, bufData, std::min(size, availableData));
   ^~~~~~
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:36:3: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:12:1:
+#include <cstring>

/Users/vietdzung/dev/projects/esp32/mitsubishi2MQTT/components/espMqttClient/src/Transport/ClientAsync.cpp:36:3:
dzungpv commented 6 months ago

Could you copy/paste the build log here?

From the bug report template:

Which platform, esp8266 or esp32? Do you use TLS or not? Do you use an IDE (Arduino, Platformio...)? Which version of the Arduino framework? Please include any debug output and/or decoded stack trace if applicable.

I am not using Arduino or Platformio, I am using ESP IDF 4.4.6 https://docs.espressif.com/projects/esp-idf/en/v4.4.6/esp32/get-started/index.html, No TLS I just use espMqttClientAsync

bertmelis commented 6 months ago

Ok, I'll have a look. The logs tell me IPAddress is unknown for AsyncTCP. But maybe AsyncTCP wasn't designed with IDF in mind.

bertmelis commented 6 months ago

Are you 100% sure you want to use the async version? (Lack of TLS and not maintained)

dzungpv commented 6 months ago

Ok, I'll have a look. The logs tell me IPAddress is unknown for AsyncTCP. But maybe AsyncTCP wasn't designed with IDF in mind.

It is compatible, it show the error because your name duplicate with it, along with String class in Packets. I am migrate to Async because current I am using it, just play with your lib, but the name must be change to support ESP IDF.

bertmelis commented 6 months ago

So can be solved by renaming the file?

dzungpv commented 6 months ago

So can be solved by renaming the file?

Yes, but for the IPAddress conflict, I just delete it. You add it only for test, may be you can find other way.

bertmelis commented 6 months ago

Does ESP-IDF have a specific macro we can check for to we can just hide it using the preprocessor?

dzungpv commented 6 months ago

Does ESP-IDF have a specific macro we can check for to we can just hide it using the preprocessor?

It have macro but same name will cause conflict. I have fixed it and pass all the test now, you can check it and merge, github actions here pass all the test: https://github.com/dzungpv/espMqttClient/actions

bertmelis commented 6 months ago

Merged into main. Will create a new release soon.

I might first add an example, but that is a bit uncharted territory for me.

dzungpv commented 6 months ago

Merged into main. Will create a new release soon.

I might first add an example, but that is a bit uncharted territory for me.

I will create a sample with github test action for you.

bertmelis commented 6 months ago

Merged into main. Will create a new release soon. I might first add an example, but that is a bit uncharted territory for me.

I will create a sample with github test action for you.

That would be a great help!