Skip to content

ESP32-P4 with custom_sdkconfig build fails: ip_addr vs ip_addr_t type mismatch (AsyncTCP.cpp) #66

Closed

Description

@qniens

IDE / Tooling

pioarduino

What happened?

When building AsyncTCP for the ESP32-P4 with custom_sdkconfig set (even without any options), compilation fails due to mismatched types between [ip_addr] and [ip_addr_t].

To Reproduce use AsyncTCP as a dependency in a PlatformIO project targeting ESP32-P4 and set custom_sdkconfig.
Build the project.

Stack Trace

.pio/libdeps/esp32-p4/AsyncTCP/src/AsyncTCP.cpp:313:27: error: cannot convert 'ip_addr_t*' {aka 'ip4_addr*'} to 'ip_addr*'
  e->client->_dns_found(&e->dns.addr);
                        ^~~~~~~~~~~~
                        ip_addr_t* {aka ip4_addr*}
.pio/libdeps/esp32-p4/AsyncTCP/src/AsyncTCP.cpp:527:34: error: invalid application of 'sizeof' to incomplete type 'ip_addr'
  memcpy(&e->dns.addr, ipaddr, sizeof(struct ip_addr));
                                 ^~~~~~~~~~~~~~~~~~~~
.pio/libdeps/esp32-p4/AsyncTCP/src/AsyncTCP.cpp:1164:12: error: no matching function for call to 'AsyncClient::connect(ip_addr&, uint16_t&)'
  connect(*ipaddr, _connect_port);
           ^~~~~~~~~~~~~~~~~~~~~

Minimal Reproductible Example (MRE)

Empty project

#include <Arduino.h>
void setup(){

}

void loop(){

}

platformio.ini

[env:esp32-p4]
platform = https://github.com/pioarduino/platform-espressif32.git
lib_compat_mode = strict
lib_ldf_mode = chain

framework = arduino
board = esp32-p4
build_flags = -D CORE_DEBUG_LEVEL=5
monitor_speed = 115200

;if you remove custom_sdkconfig will compile
custom_sdkconfig        = 
                          ; CONFIG_CACHE_L2_CACHE_256KB=y


custom_component_remove = espressif/esp_hosted
                          espressif/esp_wifi_remote
                          espressif/mdns
                          espressif/esp-dsp
                          espressif/esp_modem
                          espressif/esp32-camera

lib_deps =  
  ESP32Async/AsyncTCP
  ;ESP32Async/ESPAsyncWebServer

I confirm that:

  • I have read the documentation.
  • I have searched for similar discussions.
  • I have searched for similar issues.
  • I have looked at the examples.
  • I have upgraded to the lasted version of AsyncTCP.

Activity

  1. mathieucarbou commented on Jun 3, 2025

    @mathieucarbou
    Member

    Hi,
    Did you try with v3.4.1 ?
    Did you also try with esp32dev board (with v3.4.1 and with v3.4.3) ?

  2. mathieucarbou commented on Jun 3, 2025

    @mathieucarbou
    Member

    I am not able to reproduce. If I create a pio file with your content and create src/main.cpp with your c++ content and run pio run on CLI, I get :

    -- Project sdkconfig file /Users/mat/Downloads/test/sdkconfig.esp32-p4
    -- Configuring incomplete, errors occurred!
    
    fatal: not a git repository (or any of the parent directories): .git
    CMake Error at .pio/build/esp32-p4/CMakeFiles/git-data/grabRef.cmake:48 (file):
      file failed to open for reading (No such file or directory):
    
        /Users/mat/Downloads/test/.pio/build/esp32-p4/CMakeFiles/git-data/head-ref
    Call Stack (most recent call first):
      /Users/mat/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:83 (include)
      /Users/mat/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:93 (get_git_head_revision)
      /Users/mat/.platformio/packages/framework-espidf/tools/cmake/project.cmake:700 (git_describe)
      CMakeLists.txt:3 (project)
    
    
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/Users/mat/.platformio/penv/.espidf-5.4.1/lib/python3.11/site-packages/kconfgen/__main__.py", line 5, in <module>
        from .core import main
      File "/Users/mat/.platformio/penv/.espidf-5.4.1/lib/python3.11/site-packages/kconfgen/core.py", line 29, in <module>
        import esp_idf_kconfig.gen_kconfig_doc as gen_kconfig_doc
      File "/Users/mat/.platformio/penv/.espidf-5.4.1/lib/python3.11/site-packages/esp_idf_kconfig/gen_kconfig_doc.py", line 14, in <module>
        import kconfiglib.core as kconfiglib
      File "/Users/mat/.platformio/penv/.espidf-5.4.1/lib/python3.11/site-packages/kconfiglib/__init__.py", line 3, in <module>
        from .core import Kconfig  # noqa F401
        ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/mat/.platformio/penv/.espidf-5.4.1/lib/python3.11/site-packages/kconfiglib/core.py", line 27, in <module>
        from kconfiglib.report import PRAGMA_PREFIX
      File "/Users/mat/.platformio/penv/.espidf-5.4.1/lib/python3.11/site-packages/kconfiglib/report.py", line 29, in <module>
        from rich import print as rprint
    ModuleNotFoundError: No module named 'rich'
    CMake Error at /Users/mat/.platformio/packages/framework-espidf/tools/cmake/kconfig.cmake:209 (message):
      Failed to run kconfgen
      (/Users/mat/.platformio/penv/.espidf-5.4.1/bin/python;-m;kconfgen;--list-separator=semicolon;--kconfig;/Users/mat/.platformio/packages/framework-espidf/Kconfig;--sdkconfig-rename;/Users/mat/.platformio/packages/framework-espidf/sdkconfig.rename;--config;/Users/mat/Downloads/test/sdkconfig.esp32-p4;--defaults;/Users/mat/Downloads/test/sdkconfig.defaults;--env-file;/Users/mat/Downloads/test/.pio/build/esp32-p4/config.env).
      Error 1
    Call Stack (most recent call first):
      /Users/mat/.platformio/packages/framework-espidf/tools/cmake/build.cmake:681 (__kconfig_generate_config)
      /Users/mat/.platformio/packages/framework-espidf/tools/cmake/project.cmake:717 (idf_build_process)
      CMakeLists.txt:3 (project)
    
  3. qniens commented on Jun 3, 2025

    @qniens
    Author

    After testing many settings, different boards and Async versions, I discovered that PlatformIO/Arduino doesn't seem to clear the build cache properly (or at least that's what it looks like). Sometimes a build works correctly, and other times it doesn’t—seemingly at random.

    When manually deleting all cache/temp files in the project folder:
    Folders:

    • .dummy
    • managed_components
    • .pio/build
    • .pio/libdeps

    Files:

    • sdkconfig.defaults
    • sdkconfig.esp32-p4
    • CMakeLists.txt
    • dependencies.lock

    And these settings, it will compile.

    board = esp32-p4
    ESP32Async/AsyncTCP
    
    
    custom_sdkconfig = 
      ; CONFIG_LWIP_IPV6=n 
      ; CONFIG_LWIP_IPV6_AUTOCONFIG=n
      ; CONFIG_LWIP_PPP_SUPPORT=n
      ; CONFIG_BT_ENABLED=n
      ; CONFIG_CACHE_L2_CACHE_256KB=y
      ; CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
       CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS=y  
       CONFIG_LWIP_IRAM_OPTIMIZATION=y
       CONFIG_ETH_IRAM_OPTIMIZATION=y
       CONFIG_ESP_MAIN_TASK_STACK_SIZE=7168  
       CONFIG_COMPILER_OPTIMIZATION_PERF=y
    

    But disabling IPV6 support by uncommenting
    CONFIG_LWIP_IPV6=n

    Will produce the ip_addr_t error.
    .pio/libdeps/esp32-p4/AsyncTCP/src/AsyncTCP.cpp:313:27: error: cannot convert 'ip_addr_t*' {aka 'ip4_addr*'} to 'ip_addr*' e->client->_dns_found(&e->dns.addr); ^~~~~~~~~~~~ ip_addr_t* {aka ip4_addr*} .pio/libdeps/esp32-p4/AsyncTCP/src/AsyncTCP.cpp:527:34: error: invalid application of 'sizeof' to incomplete type 'ip_addr' memcpy(&e->dns.addr, ipaddr, sizeof(struct ip_addr)); ^~~~~~~~~~~~~~~~~~~~ .pio/libdeps/esp32-p4/AsyncTCP/src/AsyncTCP.cpp:1164:12: error: no matching function for call to 'AsyncClient::connect(ip_addr&, uint16_t&)' connect(*ipaddr, _connect_port); ^~~~~~~~~~~~~~~~~~~~~

    After an error, no other options, lib_deps or boards will compile. You need to manually clear all the caches & temp files.

    To summarize for AsyncTCP:

    It will not compile with these platformio settings:

    [env:esp32-p4]
    platform = https://github.com/pioarduino/platform-espressif32.git
    lib_compat_mode = strict
    lib_ldf_mode = chain
    
    framework = arduino
    board = esp32-p4
    ;board = esp32dev
    ;board = esp32-p4-evboard
    build_flags = -D CORE_DEBUG_LEVEL=5
    monitor_speed = 115200
    
    custom_sdkconfig = 
       CONFIG_LWIP_IPV6=n 
    
      
    
    custom_component_remove = espressif/esp_hosted
                              espressif/esp_wifi_remote
                              espressif/mdns
                              espressif/esp-dsp
                              espressif/esp_modem
                              espressif/esp32-camera
    
    lib_deps =  
      ESP32Async/AsyncTCP
    
  4. mathieucarbou commented on Jun 3, 2025

    @mathieucarbou
    Member

    I suspect CONFIG_LWIP_IPV6 is required... Even Arduino 2 has it set and AsyncTCP is for Arduino 2 and 3. It was recently opened to esp-idf only but not sure it can be used with CONFIG_LWIP_IPV6=n, especially with framework = arduino.

    Maybe @ willmmiles or @me-no-dev would know better...

    I will move this to support ticket for now, until it is proven there is a real issue which is not related to a usage problem.

  5. locked and limited conversation to collaborators on Jun 3, 2025
  6. converted this issue into a discussion #67 on Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions