espressif / esp-idf

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

Cannot build i2s_basic demos on Windows (IDFGH-13912) #14751

Open xobs opened 1 month ago

xobs commented 1 month ago

Answers checklist.

IDF version.

v5.4-dev-3602-ga97a7b0962

Operating System used.

Windows

How did you build your project?

Command line with idf.py

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

PowerShell

What is the expected behavior?

I should be able to build and run commands like idf.py menuconfig

What is the actual behavior?

[9:17:41 pm] ~/esp/esp-idf/examples/peripherals/i2s/i2s_basic/i2s_std> idf.py build
Executing action: all (aliases: build)
Running cmake in directory C:\Users\Sean\esp\esp-idf\examples\peripherals\i2s\i2s_basic\i2s_std\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=C:\Espressif\python_env\idf5.4_py3.10_env\Scripts\python.exe -DESP_PLATFORM=1 -DCCACHE_ENABLE=1 C:\Users\Sean\esp\esp-idf\examples\peripherals\i2s\i2s_basic\i2s_std"...
-- IDF_TARGET not set, using default target: esp32
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.40.0.windows.1")
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Espressif/tools/xtensa-esp-elf/esp-14.2.0_20240906/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Espressif/tools/xtensa-esp-elf/esp-14.2.0_20240906/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe - 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: C:/Espressif/tools/xtensa-esp-elf/esp-14.2.0_20240906/xtensa-esp-elf/bin/xtensa-esp32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
CMake Error at build/component_requires.temp.cmake:4 (__component_set_property):
  Syntax error in cmake code at

    C:/Users/Sean/esp/esp-idf/examples/peripherals/i2s/i2s_basic/i2s_std/build/component_requires.temp.cmake:4

  when parsing string

    .;C:\Users\Sean\esp\esp-idf/examples/peripherals/i2s/common

  Invalid character escape '\U'.
Call Stack (most recent call first):
  C:/Users/Sean/esp/esp-idf/tools/cmake/component.cmake:258 (include)
  C:/Users/Sean/esp/esp-idf/tools/cmake/build.cmake:643 (__component_get_requirements)
  C:/Users/Sean/esp/esp-idf/tools/cmake/project.cmake:710 (idf_build_process)
  CMakeLists.txt:8 (project)

-- Configuring incomplete, errors occurred!
cmake failed with exit code 1, output of the command is in the C:\Users\Sean\esp\esp-idf\examples\peripherals\i2s\i2s_basic\i2s_std\build\log\idf_py_stderr_output_65328 and C:\Users\Sean\esp\esp-idf\examples\peripherals\i2s\i2s_basic\i2s_std\build\log\idf_py_stdout_output_65328
[9:17:51 pm] ~/esp/esp-idf/examples/peripherals/i2s/i2s_basic/i2s_std>

Steps to reproduce.

  1. Try ro build examples/peripherals/i2s/i2s_basic/i2s_std on Windows

Build or installation Logs.

No response

More Information.

This is likely caused by importing $ENV{IDF_PATH} directly into INCLUDE_DIRS, which makes the variable as follows:

__component_set_property(___idf_main INCLUDE_DIRS ".;C:\Users\Sean\esp\esp-idf/examples/peripherals/i2s/common")

It's complaining about C:\U

dothanhdat1413 commented 3 weeks ago

This is due to the reference address in Window. I fixed this by replacing the $ENV{IDF_PATH} in main/CMakeLists.txt with the real address in my computer. It works but I think that this way is just a temporary solution to run the example once.

idf_component_register(SRCS "${srcs}" PRIV_REQUIRES esp_driver_i2s esp_driver_gpio INCLUDE_DIRS "." "$ENV{IDF_PATH}/examples/peripherals/i2s/common")

replace $ENV{IDF_PATH} with the address in computer