乐鑫技术交流
直播中

李林

7年用户 1219经验值
私信 关注
[问答]

MacOS ESP-IDF编译hello_world无法成功的原因?

Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)")
-- 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: /Users/marlon/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/marlon/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc - 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: /Users/marlon/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /Users/marlon/esp/hello_world/sdkconfig
-- Found PythonInterp: /Users/marlon/.espressif/python_env/idf4.4_py3.8_env/bin/python (found version "3.8.11")
-- Found Perl: /usr/local/bin/perl (found version "5.34.0")
-- App "hello-world" version: 1
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
-- Adding linker script /Users/marlon/esp/hello_world/build/esp-idf/esp32/esp32_out.ld
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp32/ld/esp32.project.ld.in
-- Adding linker script /Users/marlon/esp/esp-idf/components/esp32/ld/esp32.peripherals.ld
-- Components: app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub 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 idf_test jsmn json libsodium log lwip main mbedtls mdns mqtt newlib nghttp nvs_flash openssl openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /Users/marlon/esp/esp-idf/components/app_trace /Users/marlon/esp/esp-idf/components/app_update /Users/marlon/esp/esp-idf/components/asio /Users/marlon/esp/esp-idf/components/bootloader /Users/marlon/esp/esp-idf/components/bootloader_support /Users/marlon/esp/esp-idf/components/bt /Users/marlon/esp/esp-idf/components/cbor /Users/marlon/esp/esp-idf/components/cmock /Users/marlon/esp/esp-idf/components/coap /Users/marlon/esp/esp-idf/components/console /Users/marlon/esp/esp-idf/components/cxx /Users/marlon/esp/esp-idf/components/driver /Users/marlon/esp/esp-idf/components/efuse /Users/marlon/esp/esp-idf/components/esp-tls /Users/marlon/esp/esp-idf/components/esp32 /Users/marlon/esp/esp-idf/components/esp_adc_cal /Users/marlon/esp/esp-idf/components/esp_common /Users/marlon/esp/esp-idf/components/esp_eth /Users/marlon/esp/esp-idf/components/esp_event /Users/marlon/esp/esp-idf/components/esp_gdbstub /Users/marlon/esp/esp-idf/components/esp_hid /Users/marlon/esp/esp-idf/components/esp_http_client /Users/marlon/esp/esp-idf/components/esp_http_server /Users/marlon/esp/esp-idf/components/esp_https_ota /Users/marlon/esp/esp-idf/components/esp_https_server /Users/marlon/esp/esp-idf/components/esp_hw_support /Users/marlon/esp/esp-idf/components/esp_ipc /Users/marlon/esp/esp-idf/components/esp_lcd /Users/marlon/esp/esp-idf/components/esp_local_ctrl /Users/marlon/esp/esp-idf/components/esp_netif /Users/marlon/esp/esp-idf/components/esp_phy /Users/marlon/esp/esp-idf/components/esp_pm /Users/marlon/esp/esp-idf/components/esp_ringbuf /Users/marlon/esp/esp-idf/components/esp_rom /Users/marlon/esp/esp-idf/components/esp_serial_slave_link /Users/marlon/esp/esp-idf/components/esp_system /Users/marlon/esp/esp-idf/components/esp_timer /Users/marlon/esp/esp-idf/components/esp_websocket_client /Users/marlon/esp/esp-idf/components/esp_wifi /Users/marlon/esp/esp-idf/components/espcoredump /Users/marlon/esp/esp-idf/components/esptool_py /Users/marlon/esp/esp-idf/components/expat /Users/marlon/esp/esp-idf/components/fatfs /Users/marlon/esp/esp-idf/components/freemodbus /Users/marlon/esp/esp-idf/components/freertos /Users/marlon/esp/esp-idf/components/hal /Users/marlon/esp/esp-idf/components/heap /Users/marlon/esp/esp-idf/components/idf_test /Users/marlon/esp/esp-idf/components/jsmn /Users/marlon/esp/esp-idf/components/json /Users/marlon/esp/esp-idf/components/libsodium /Users/marlon/esp/esp-idf/components/log /Users/marlon/esp/esp-idf/components/lwip /Users/marlon/esp/hello_world/main /Users/marlon/esp/esp-idf/components/mbedtls /Users/marlon/esp/esp-idf/components/mdns /Users/marlon/esp/esp-idf/components/mqtt /Users/marlon/esp/esp-idf/components/newlib /Users/marlon/esp/esp-idf/components/nghttp /Users/marlon/esp/esp-idf/components/nvs_flash /Users/marlon/esp/esp-idf/components/openssl /Users/marlon/esp/esp-idf/components/openthread /Users/marlon/esp/esp-idf/components/partition_table /Users/marlon/esp/esp-idf/components/perfmon /Users/marlon/esp/esp-idf/components/protobuf-c /Users/marlon/esp/esp-idf/components/protocomm /Users/marlon/esp/esp-idf/components/pthread /Users/marlon/esp/esp-idf/components/sdmmc /Users/marlon/esp/esp-idf/components/soc /Users/marlon/esp/esp-idf/components/spi_flash /Users/marlon/esp/esp-idf/components/spiffs /Users/marlon/esp/esp-idf/components/tcp_transport /Users/marlon/esp/esp-idf/components/tcpip_adapter /Users/marlon/esp/esp-idf/components/tinyusb /Users/marlon/esp/esp-idf/components/ulp /Users/marlon/esp/esp-idf/components/unity /Users/marlon/esp/esp-idf/components/vfs /Users/marlon/esp/esp-idf/components/wear_levelling /Users/marlon/esp/esp-idf/components/wifi_provisioning /Users/marlon/esp/esp-idf/components/wpa_supplicant /Users/marlon/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/marlon/esp/hello_world/build
[1/988] Generating project_elf_src_esp32.c
[2/988] Generating linker script...
[3/988] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************
[4/988] Building C object esp-idf/lwip/CMakeFiles/__idf_lwip.dir/lwip/src/api/netifapi.c.obj
FAILED: esp-idf/lwip/CMakeFiles/__idf_lwip.dir/lwip/src/api/netifapi.c.obj
/Users/marlon/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -Iconfig -I/Users/marlon/esp/esp-idf/components/lwip/include/apps -I/Users/marlon/esp/esp-idf/components/lwip/include/apps/sntp -I/Users/marlon/esp/esp-idf/components/lwip/lwip/src/include -I/Users/marlon/esp/esp-idf/components/lwip/port/esp32/include -I/Users/marlon/esp/esp-idf/components/lwip/port/esp32/include/arch -I/Users/marlon/esp/esp-idf/components/newlib/platform_include -I/Users/marlon/esp/esp-idf/components/freertos/include -I/Users/marlon/esp/esp-idf/components/freertos/port/xtensa/include -I/Users/marlon/esp/esp-idf/components/esp_hw_support/include -I/Users/marlon/esp/esp-idf/components/esp_hw_support/include/soc -I/Users/marlon/esp/esp-idf/components/esp_hw_support/port/esp32/. -I/Users/marlon/esp/esp-idf/components/heap/include -I/Users/marlon/esp/esp-idf/components/log/include -I/Users/marlon/esp/esp-idf/components/soc/include -I/Users/marlon/esp/esp-idf/components/soc/esp32/. -I/Users/marlon/esp/esp-idf/components/soc/esp32/include -I/Users/marlon/esp/esp-idf/components/hal/esp32/include -I/Users/marlon/esp/esp-idf/components/hal/include -I/Users/marlon/esp/esp-idf/components/hal/platform_port/include -I/Users/marlon/esp/esp-idf/components/esp_rom/include -I/Users/marlon/esp/esp-idf/components/esp_rom/esp32 -I/Users/marlon/esp/esp-idf/components/esp_rom/include/esp32 -I/Users/marlon/esp/esp-idf/components/esp_common/include -I/Users/marlon/esp/esp-idf/components/esp_system/include -I/Users/marlon/esp/esp-idf/components/esp_system/port/soc -I/Users/marlon/esp/esp-idf/components/esp_system/port/public_compat -I/Users/marlon/esp/esp-idf/components/esp32/include -I/Users/marlon/esp/esp-idf/components/driver/include -I/Users/marlon/esp/esp-idf/components/driver/esp32/include -I/Users/marlon/esp/esp-idf/components/esp_pm/include -I/Users/marlon/esp/esp-idf/components/esp_ringbuf/include -I/Users/marlon/esp/esp-idf/components/efuse/include -I/Users/marlon/esp/esp-idf/components/efuse/esp32/include -I/Users/marlon/esp/esp-idf/components/xtensa/include -I/Users/marlon/esp/esp-idf/components/xtensa/esp32/include -I/Users/marlon/esp/esp-idf/components/vfs/include -I/Users/marlon/esp/esp-idf/components/esp_wifi/include -I/Users/marlon/esp/esp-idf/components/esp_event/include -I/Users/marlon/esp/esp-idf/components/esp_netif/include -I/Users/marlon/esp/esp-idf/components/esp_eth/include -I/Users/marlon/esp/esp-idf/components/tcpip_adapter/include -I/Users/marlon/esp/esp-idf/components/esp_phy/include -I/Users/marlon/esp/esp-idf/components/esp_phy/esp32/include -I/Users/marlon/esp/esp-idf/components/app_trace/include -I/Users/marlon/esp/esp-idf/components/esp_timer/include -I/Users/marlon/esp/esp-idf/components/nvs_flash/include -I/Users/marlon/esp/esp-idf/components/spi_flash/include -I/Users/marlon/esp/esp-idf/components/mbedtls/port/include -I/Users/marlon/esp/esp-idf/components/mbedtls/mbedtls/include -I/Users/marlon/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -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/marlon/esp/hello_world=. -fmacro-prefix-map=/Users/marlon/esp/esp-idf=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER="v4.4-dev-1849-g8e3e65a47" -DESP_PLATFORM -Wno-address -MD -MT esp-idf/lwip/CMakeFiles/__idf_lwip.dir/lwip/src/api/netifapi.c.obj -MF esp-idf/lwip/CMakeFiles/__idf_lwip.dir/lwip/src/api/netifapi.c.obj.d -o esp-idf/lwip/CMakeFiles/__idf_lwip.dir/lwip/src/api/netifapi.c.obj -c /Users/marlon/esp/esp-idf/components/lwip/lwip/src/api/netifapi.c
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:62,
                 from /Users/marlon/esp/esp-idf/components/lwip/port/esp32/include/lwipopts.h:35,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/include/lwip/opt.h:51,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/api/netifapi.c:41:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:828:2: error: #error Unsupported architecture
#error Unsupported architecture
  ^~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:64,
                 from /Users/marlon/esp/esp-idf/components/lwip/port/esp32/include/lwipopts.h:35,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/include/lwip/opt.h:51,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/api/netifapi.c:41:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:36:2: error: #error architecture not supported
#error architecture not supported
  ^~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:64,
                 from /Users/marlon/esp/esp-idf/components/lwip/port/esp32/include/lwipopts.h:35,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/include/lwip/opt.h:51,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/api/netifapi.c:41:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
         ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
         ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_dev_t;         /* dev_t */
         ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
         ^~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
         ^~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'
typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
         ^~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
         ^~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'
typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
         ^~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'
typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
         ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
         ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
         ^~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'
typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
         ^~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
         ^~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'
typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
         ^~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:82,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/wait.h:109,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66,
                 from /Users/marlon/esp/esp-idf/components/lwip/port/esp32/include/lwipopts.h:35,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/include/lwip/opt.h:51,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/api/netifapi.c:41:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/signal.h:36:2: error: #error architecture not supported
#error architecture not supported
  ^~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:146,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/wait.h:109,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:66,
                 from /Users/marlon/esp/esp-idf/components/lwip/port/esp32/include/lwipopts.h:35,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/include/lwip/opt.h:51,
                 from /Users/marlon/esp/esp-idf/components/lwip/lwip/src/api/netifapi.c:41:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_mcontext.h:33:2: error: #error architecture not supported

回帖(1)

听风说梦

2024-6-21 16:49:40
根据您提供的信息,您正在尝试使用ESP-IDF在MacOS上编译一个hello_world项目。在编译过程中,您遇到了一些问题。为了解决这个问题,我们可以按照以下步骤进行排查:

1. 确认ESP-IDF安装正确:请确保您已经按照官方文档正确安装了ESP-IDF。您可以访问 https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#installation-step-by-step 以获取详细的安装指南。

2. 检查环境变量:确保您的环境变量设置正确。特别是`PATH`变量,它应该包含ESP-IDF的工具链路径。例如:
   ```
   export PATH=$PATH:$HOME/esp/esp-idf/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin
   ```

3. 确认项目结构:确保您的项目结构与ESP-IDF的示例项目一致。您可以从ESP-IDF的示例项目中获取正确的结构:https://github.com/espressif/esp-idf/tree/master/examples

4. 检查编译命令:确保您使用了正确的命令来编译项目。通常,您可以使用以下命令:
   ```
   cd
   idf.py build
   ```

5. 分析错误信息:如果编译过程中出现错误,请仔细阅读错误信息。错误信息通常会告诉您问题所在,例如缺少依赖、语法错误等。

6. 更新工具链:如果您的工具链版本过旧,可能会导致编译失败。请尝试更新ESP-IDF和工具链到最新版本。

7. 检查硬件连接:确保您的ESP32开发板与计算机连接正常,并且驱动程序已正确安装。


举报

更多回帖

发帖
×
20
完善资料,
赚取积分