espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.29k stars 7.2k forks source link

esp_netif_linux component not found when setting linux target (IDFGH-12383) #13411

Open aparsons-gradient opened 5 months ago

aparsons-gradient commented 5 months ago

Answers checklist.

IDF version.

v5.2.1

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

What is the expected behavior?

I'm running idf.py --preview set-target linux on a project that builds successfully for an esp32s3 target. In the initial step where the build system attempts to generate a sdkconfig file, I would expect this to finish successfully.

What is the actual behavior?

The configuration step fails with an error that the esp_netif_linux component can't be found. This makes sense from what I can see because there is no component with that name in the idf/components folder. I'm assuming that maybe a name parsing function is concatenating this incorrectly?

Steps to reproduce.

  1. Setup a project that uses esp_netif as a dependency
  2. Run idf.py --preview set-target linux

Build or installation Logs.

Executing action: set-target
Set Target to: linux, new sdkconfig will be created.
Running cmake in directory /home/X/Code/X/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/home/X/.espressif/python_env/idf5.2_py3.8_env/bin/python -DESP_PLATFORM=1 -DIDF_TARGET=linux -DCCACHE_ENABLE=0 /home/X/Code/X"...
-- Found Git: /usr/bin/git (found version "2.44.0") 
-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test ver_gnu17_supported
-- Performing Test ver_gnu17_supported - Success
-- Performing Test ver_gnu++2b_supported
-- Performing Test ver_gnu++2b_supported - Success
-- The ASM compiler identification is GNU
-- Found assembler: /usr/lib64/ccache/cc
-- Building ESP-IDF components for target linux
Processing 3 dependencies:
[1/3] espressif/mdns (1.2.5)
[2/3] espressif/nghttp (1.58.0)
[3/3] idf (5.2.1)
CMake Error at /home/X/Code/esp-idf/tools/cmake/build.cmake:268 (message):
  Failed to resolve component 'esp_netif_linux'.
Call Stack (most recent call first):
  /home/X/Code/esp-idf/tools/cmake/build.cmake:304 (__build_resolve_and_add_req)
  /home/X/Code/esp-idf/tools/cmake/build.cmake:311 (__build_expand_requirements)
  /home/X/Code/esp-idf/tools/cmake/build.cmake:599 (__build_expand_requirements)
  /home/X/Code/esp-idf/tools/cmake/project.cmake:605 (idf_build_process)
  CMakeLists.txt:11 (project)

-- Configuring incomplete, errors occurred!
HINT: The component esp_netif_linux could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager or has been removed and refactored into some other component.
Please look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.
Refer to the migration guide for more details about moved components.
Refer to the build-system guide for more details about how components are found and included in the build.

More Information.

No response

david-cermak commented 5 months ago

Hi @aparsons-gradient

This dependency comes from the mdns component, which needs some specific low layer netif API (on linux, it's not a generic implementation, so we cannot place it under IDF as a universal network component). you can workaround this by cloning https://github.com/espressif/esp-protocols to $PROTOCOLS_PATH and adding this line to your project makefile:

set(EXTRA_COMPONENT_DIRS 
    "${PROTOCOLS_PATH}/common_components/linux_compat"
    "${PROTOCOLS_PATH}/components/mdns/tests/host_test/components")

The ultimate solution would be to add official support for these experimental components, esp. esp_timer and esp_netif under linux.

aparsons-gradient commented 5 months ago

@david-cermak thanks for the response and workaround! I think we might wait until Posix support is a bit more stable before moving forward with that. Thanks again.