ESP HomeKit SDK 示例工程首次编译失败

hhhyyy
Posts: 1
Joined: Fri Aug 26, 2022 5:35 am

ESP HomeKit SDK 示例工程首次编译失败

Postby hhhyyy » Fri Aug 26, 2022 7:03 am

尝试跑通ESP HomeKit SDK提供的 Fan 示例工程,但在首次编译时出现错误,执行“idf.py set-target”或“idf.py menuconfig”等命令时报错,截取log中报错部分如下:

Code: Select all

CMake Error:
  Running

   'C:/Softwares/Espressif/tools/ninja/1.10.2/ninja.exe' '-C' 'D:/Workspace/eps_homekit/esp-homekit-sdk/examples/fan/build' '-t' 'recompact'

  failed with:

   ninja: error: build.ninja:21592: lexing error
    DEFINES = -D MFI_VER="\"4.0-??? Linux ? Windows ?????????????
                                                                 ^ near here



CMake Generate step failed.  Build files cannot be regenerated correctly.
cmake failed with exit code 1
似乎是因为自动生成的 “build/build.ninja” 文件中出现了非法字符, “build/build.ninja” 文件的第21586-21592行内容为:

Code: Select all

#############################################
# Order-only phony target for __idf_esp_hap_core

build cmake_object_order_depends_target___idf_esp_hap_core: phony || cmake_object_order_depends_target___idf_esp_hap_apple_profiles

build esp-idf/esp_hap_core/CMakeFiles/__idf_esp_hap_core.dir/src/byte_convert.c.obj: C_COMPILER____idf_esp_hap_core_ D$:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/esp_hap_core/src/byte_convert.c || cmake_object_order_depends_target___idf_esp_hap_core
  DEFINES = -D MFI_VER="\"4.0-??? Linux ? Windows ?????????????
其中触发错误的21592行内容为:
DEFINES = -D MFI_VER="\"4.0-??? Linux ? Windows ?????????????
可见在“build/build.ninja” 的 21592 行出现了很多问号,可能是在自动生成时存在编码格式问题,“build/build.ninja” 文件中共有22处相同内容的行,请教如何修复这个问题 :?



环境
IDF:v4.4;
操作系统:Windows。


详细步骤及完整log
1. 从https://github.com/espressif/esp-homekit-sdk 拉取 ESP-homekit-SDK 到本地;
2. 通过命令 ‘idf.py set-target esp32c3’ 设置芯片型号报错,完整log如下:

Code: Select all

Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Directory 'd:\workspace\eps_homekit\esp-homekit-sdk\examples\fan\build' doesn't seem to be a CMake build directory. Refusing to automatically delete files in this directory. Delete the directory manually to 'clean' it.
PS D:\Workspace\eps_homekit\esp-homekit-sdk\examples\fan> idf.py set-target esp32c3
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Directory 'd:\workspace\eps_homekit\esp-homekit-sdk\examples\fan\build' doesn't seem to be a CMake build directory. Refusing to automatically delete files in this directory. Delete the directory manually to 'clean' it.
PS D:\Workspace\eps_homekit\esp-homekit-sdk\examples\fan> idf.py set-target esp32c3
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory 'd:\workspace\eps_homekit\esp-homekit-sdk\examples\fan\build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32c3, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory d:\workspace\eps_homekit\esp-homekit-sdk\examples\fan\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32c3 -DCCACHE_ENABLE=1 d:\workspace\eps_homekit\esp-homekit-sdk\examples\fan"...
-- Found Git: C:/Softwares/Espressif/tools/idf-git/2.34.2/cmd/git.exe (found version "2.34.1.windows.1")
-- Component directory D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit does not contain a CMakeLists.txt file. No component will be added
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Softwares/Espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Softwares/Espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-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:/Softwares/Espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c3
Skipping optional dependency: espressif/libsodium
-- 4.0-??? Linux ? Windows ?????????????
?????? Microsoft Store ??????:
https://aka.ms/wslstore

Skipping optional dependency: espressif/libsodium
-- Project sdkconfig file D:/Workspace/eps_homekit/esp-homekit-sdk/examples/fan/sdkconfig
Loading defaults file D:/Workspace/eps_homekit/esp-homekit-sdk/examples/fan/sdkconfig.defaults...
-- Found Python3: C:/Softwares/Espressif/python_env/idf4.4_py3.8_env/Scripts/python.exe (found version "3.8.7") found components: Interpreter
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "fan" version: fac2032
-- Adding linker script D:/Workspace/eps_homekit/esp-homekit-sdk/examples/fan/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/ld/esp32c3/sections.ld.in
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom/esp32c3/ld/esp32c3.rom.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom/esp32c3/ld/esp32c3.rom.version.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib-time.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.2/components/soc/esp32c3/ld/esp32c3.peripherals.ld
-- 4.0-??? Linux ? Windows ?????????????
?????? Microsoft Store ??????:
https://aka.ms/wslstore

-- ESP HomeKit SDK Project commit: fac2032
-- Components: app_hap_setup_payload app_trace app_update app_wifi asio bootloader bootloader_support bt button cbor cmock coap console cxx driver efuse esp-tls esp32c3 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hap_apple_profiles esp_hap_core esp_hap_extras esp_hap_platform esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_ipc esp_lcd esp_local_ctrl esp_netif esp_phy esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos hal heap hkdf-sha idf_test ieee802154 jsmn json json_generator json_parser libsodium log lwip main mbedtls mdns mqtt mu_srp newlib nghttp nvs_flash openssl openthread partition_table protobuf-c protocomm pthread qrcode riscv sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb unity usb vfs wear_levelling wifi_provisioning wpa_supplicant
-- Component paths: D:/Workspace/eps_homekit/esp-homekit-sdk/examples/common/app_hap_setup_payload C:/Espressif/frameworks/esp-idf-v4.4.2/components/app_trace C:/Espressif/frameworks/esp-idf-v4.4.2/components/app_update D:/Workspace/eps_homekit/esp-homekit-sdk/examples/common/app_wifi C:/Espressif/frameworks/esp-idf-v4.4.2/components/asio C:/Espressif/frameworks/esp-idf-v4.4.2/components/bootloader C:/Espressif/frameworks/esp-idf-v4.4.2/components/bootloader_support C:/Espressif/frameworks/esp-idf-v4.4.2/components/bt D:/Workspace/eps_homekit/esp-homekit-sdk/components/button C:/Espressif/frameworks/esp-idf-v4.4.2/components/cbor C:/Espressif/frameworks/esp-idf-v4.4.2/components/cmock C:/Espressif/frameworks/esp-idf-v4.4.2/components/coap C:/Espressif/frameworks/esp-idf-v4.4.2/components/console C:/Espressif/frameworks/esp-idf-v4.4.2/components/cxx C:/Espressif/frameworks/esp-idf-v4.4.2/components/driver C:/Espressif/frameworks/esp-idf-v4.4.2/components/efuse C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp-tls C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp32c3 C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_adc_cal C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_eth C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_event C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_gdbstub D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/esp_hap_apple_profiles D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/esp_hap_core D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/esp_hap_extras D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/esp_hap_platform C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_hid C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_http_client C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_http_server C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_https_ota C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_https_server C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_hw_support C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_ipc C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_lcd C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_local_ctrl C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_netif C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_phy C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_pm C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_ringbuf C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_rom C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_serial_slave_link C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_timer C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_websocket_client C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_wifi C:/Espressif/frameworks/esp-idf-v4.4.2/components/espcoredump C:/Espressif/frameworks/esp-idf-v4.4.2/components/esptool_py C:/Espressif/frameworks/esp-idf-v4.4.2/components/expat C:/Espressif/frameworks/esp-idf-v4.4.2/components/fatfs C:/Espressif/frameworks/esp-idf-v4.4.2/components/freemodbus C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal C:/Espressif/frameworks/esp-idf-v4.4.2/components/heap D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/hkdf-sha C:/Espressif/frameworks/esp-idf-v4.4.2/components/idf_test C:/Espressif/frameworks/esp-idf-v4.4.2/components/ieee802154 C:/Espressif/frameworks/esp-idf-v4.4.2/components/jsmn C:/Espressif/frameworks/esp-idf-v4.4.2/components/json D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/json_generator D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/json_parser C:/Espressif/frameworks/esp-idf-v4.4.2/components/libsodium C:/Espressif/frameworks/esp-idf-v4.4.2/components/log C:/Espressif/frameworks/esp-idf-v4.4.2/components/lwip D:/Workspace/eps_homekit/esp-homekit-sdk/examples/fan/main C:/Espressif/frameworks/esp-idf-v4.4.2/components/mbedtls C:/Espressif/frameworks/esp-idf-v4.4.2/components/mdns C:/Espressif/frameworks/esp-idf-v4.4.2/components/mqtt D:/Workspace/eps_homekit/esp-homekit-sdk/components/homekit/mu_srp C:/Espressif/frameworks/esp-idf-v4.4.2/components/newlib C:/Espressif/frameworks/esp-idf-v4.4.2/components/nghttp C:/Espressif/frameworks/esp-idf-v4.4.2/components/nvs_flash C:/Espressif/frameworks/esp-idf-v4.4.2/components/openssl C:/Espressif/frameworks/esp-idf-v4.4.2/components/openthread C:/Espressif/frameworks/esp-idf-v4.4.2/components/partition_table C:/Espressif/frameworks/esp-idf-v4.4.2/components/protobuf-c C:/Espressif/frameworks/esp-idf-v4.4.2/components/protocomm C:/Espressif/frameworks/esp-idf-v4.4.2/components/pthread D:/Workspace/eps_homekit/esp-homekit-sdk/examples/common/qrcode C:/Espressif/frameworks/esp-idf-v4.4.2/components/riscv C:/Espressif/frameworks/esp-idf-v4.4.2/components/sdmmc C:/Espressif/frameworks/esp-idf-v4.4.2/components/soc C:/Espressif/frameworks/esp-idf-v4.4.2/components/spi_flash C:/Espressif/frameworks/esp-idf-v4.4.2/components/spiffs C:/Espressif/frameworks/esp-idf-v4.4.2/components/tcp_transport C:/Espressif/frameworks/esp-idf-v4.4.2/components/tcpip_adapter C:/Espressif/frameworks/esp-idf-v4.4.2/components/tinyusb C:/Espressif/frameworks/esp-idf-v4.4.2/components/unity C:/Espressif/frameworks/esp-idf-v4.4.2/components/usb C:/Espressif/frameworks/esp-idf-v4.4.2/components/vfs C:/Espressif/frameworks/esp-idf-v4.4.2/components/wear_levelling C:/Espressif/frameworks/esp-idf-v4.4.2/components/wifi_provisioning C:/Espressif/frameworks/esp-idf-v4.4.2/components/wpa_supplicant
-- Configuring done
-- Generating done
CMake Error:
  Running

   'C:/Softwares/Espressif/tools/ninja/1.10.2/ninja.exe' '-C' 'D:/Workspace/eps_homekit/esp-homekit-sdk/examples/fan/build' '-t' 'recompact'

  failed with:

   ninja: error: build.ninja:21592: lexing error
    DEFINES = -D MFI_VER="\"4.0-??? Linux ? Windows ?????????????
                                                                 ^ near here



CMake Generate step failed.  Build files cannot be regenerated correctly.
cmake failed with exit code 1

“build/build.ninja”完整文件见附件:
build.ninja.txt
报错的build.ninja文件
(8.26 MiB) Downloaded 317 times

yinke_esp
Posts: 2
Joined: Fri Oct 28, 2022 9:00 am

Re: ESP HomeKit SDK 示例工程首次编译失败

Postby yinke_esp » Thu Feb 02, 2023 8:30 am

大哥,我也遇到一摸一样的问题,请问有解决方法吗

Who is online

Users browsing this forum: Google [Bot], virgil and 80 guests