ivmarkov / rust-esp32-std-demo

Rust on ESP32 STD demo app. A demo STD binary crate for the ESP32[XX] and ESP-IDF, which connects to WiFi, Ethernet, drives a small HTTP server and draws on a LED screen.
Apache License 2.0
785 stars 105 forks source link

build error #160

Closed freew01f closed 6 months ago

freew01f commented 6 months ago

I reset the MacOS and install rust env when I build this project I got

RUST_BACKTRACE=full cargo +nightly build

warning: esp-idf-sys@0.34.0: Configuring first supported MCU 'esp32c3' derived from the build target 'riscv32imc-esp-espidf' supporting MCUs [esp32c3, esp32c2]; explicitly specify an MCU to resolve this ambiguity

error: failed to run custom build command for `esp-idf-sys v0.34.0`

Caused by:
  process didn't exit successfully: `/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/debug/build/esp-idf-sys-0adec3283e1a35e9/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  cargo:rerun-if-env-changed=ESP_IDF_SYS_ROOT_CRATE
  cargo:rerun-if-env-changed=ESP_IDF_VERSION
  cargo:rerun-if-env-changed=ESP_IDF_REPOSITORY
  cargo:rerun-if-env-changed=ESP_IDF_CMAKE_GENERATOR
  cargo:rerun-if-env-changed=IDF_PATH
  cargo:rerun-if-env-changed=EXTRA-COMPONENTS
  cargo:rerun-if-env-changed=ESP_IDF_COMPONENTS
  cargo:rerun-if-env-changed=ESP_IDF_COMPONENT_MANAGER
  cargo:warning=Configuring first supported MCU 'esp32c3' derived from the build target 'riscv32imc-esp-espidf' supporting MCUs [esp32c3, esp32c2]; explicitly specify an MCU to resolve this ambiguity
  cargo:rerun-if-changed=/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/sdkconfig.defaults
  cargo:rerun-if-changed=/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/sdkconfig.defaults.esp32
  cargo:rerun-if-changed=/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/sdkconfig.defaults.esp32s2
  running: "cc" "--version"
  exit status: 0
  running: "c++" "--version"
  exit status: 0
  CMAKE_PREFIX_PATH_riscv32imc_zicsr_zifencei-esp-espidf = None
  CMAKE_PREFIX_PATH_riscv32imc_zicsr_zifencei_esp_espidf = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_riscv32imc_zicsr_zifencei-esp-espidf = None
  CMAKE_riscv32imc_zicsr_zifencei_esp_espidf = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-c19c902b3a01e135/out/build" && CMAKE_PREFIX_PATH="" EXTRA_COMPONENT_DIRS="" IDF_COMPONENT_MANAGER="1" IDF_PATH="/Users/freewolf/esp/esp-idf-v5.1.2" IDF_TARGET="esp32c3" PATH="/Users/freewolf/esp/esp-idf-v5.1.2/components/espcoredump:/Users/freewolf/esp/esp-idf-v5.1.2/components/partition_table:/Users/freewolf/esp/esp-idf-v5.1.2/components/app_update:/Users/freewolf/.espressif/tools/xtensa-esp-elf-gdb/12.1_20221002/xtensa-esp-elf-gdb/bin:/Users/freewolf/.espressif/tools/riscv32-esp-elf-gdb/12.1_20221002/riscv32-esp-elf-gdb/bin:/Users/freewolf/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin:/Users/freewolf/.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin:/Users/freewolf/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin:/Users/freewolf/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Users/freewolf/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/freewolf/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/freewolf/.espressif/python_env/idf5.1_py3.12_env/bin:/Users/freewolf/esp/esp-idf-v5.1.2/tools:/Users/freewolf/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/opt/homebrew/opt/make/libexec/gnubin:/Users/freewolf/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/node@18/bin:/opt/homebrew/opt/openjdk@17/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/freewolf/.cargo/bin" PROJECT_DIR="/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo" SDKCONFIG_DEFAULTS="/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-c19c902b3a01e135/out/gen-sdkconfig.defaults;/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/sdkconfig.defaults;/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/sdkconfig.defaults.esp32;/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/sdkconfig.defaults.esp32s2" "cmake" "/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-c19c902b3a01e135/out" "-G" "Ninja" "-DCMAKE_TOOLCHAIN_FILE=/Users/freewolf/esp/esp-idf-v5.1.2/tools/cmake/toolchain-esp32c3.cmake" "-DCMAKE_BUILD_TYPE=" "-DPYTHON=/Users/freewolf/.espressif/python_env/idf5.1_py3.12_env/bin/python" "-DCMAKE_INSTALL_PREFIX=/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-c19c902b3a01e135/out" "-DCMAKE_C_FLAGS= -march=rv32imc_zicsr_zifencei -ffunction-sections -fdata-sections --target=riscv32imc_zicsr_zifencei-esp-espidf" "-DCMAKE_CXX_FLAGS= -march=rv32imc_zicsr_zifencei -ffunction-sections -fdata-sections --target=riscv32imc_zicsr_zifencei-esp-espidf" "-DCMAKE_ASM_FLAGS=  -ffunction-sections -fdata-sections --target=riscv32imc_zicsr_zifencei-esp-espidf"
  -- The C compiler identification is GNU 12.2.0
  -- The CXX compiler identification is GNU 12.2.0
  -- The ASM compiler identification is GNU
  -- Found assembler: /Users/freewolf/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - failed
  -- Check for working C compiler: /Users/freewolf/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
  -- Check for working C compiler: /Users/freewolf/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc - broken
  -- Configuring incomplete, errors occurred!

  --- stderr
  Build configuration: BuildConfig {
      esp_idf_tools_install_dir: None,
      esp_idf_sdkconfig: None,
      esp_idf_sdkconfig_defaults: Some(
          [
              "sdkconfig.defaults",
              "sdkconfig.defaults.esp32",
              "sdkconfig.defaults.esp32s2",
          ],
      ),
      mcu: None,
      native: NativeConfig {
          esp_idf_version: Some(
              Tag(
                  "v5.1",
              ),
          ),
          esp_idf_repository: None,
          esp_idf_cmake_generator: None,
          idf_path: Some(
              "/Users/freewolf/esp/esp-idf-v5.1.2",
          ),
          extra_components: [],
          esp_idf_components: None,
          esp_idf_component_manager: None,
      },
      esp_idf_sys_root_crate: None,
  }
  Using activated esp-idf v5.1.2 environment at '/Users/freewolf/esp/esp-idf-v5.1.2'
  CMake Error at /opt/homebrew/Cellar/cmake/3.28.3/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
    The C compiler

      "/Users/freewolf/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: '/Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-c19c902b3a01e135/out/build/CMakeFiles/CMakeScratch/TryCompile-Z3g5Ka'

      Run Build Command(s): /Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/.embuild/espressif/tools/ninja/1.10.2/ninja -v cmTC_14f64
      [1/2] /Users/freewolf/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc   -march=rv32imc_zicsr_zifencei  -ffunction-sections -fdata-sections --target=riscv32imc_zicsr_zifencei-esp-espidf -o CMakeFiles/cmTC_14f64.dir/testCCompiler.c.obj -c /Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-c19c902b3a01e135/out/build/CMakeFiles/CMakeScratch/TryCompile-Z3g5Ka/testCCompiler.c
      FAILED: CMakeFiles/cmTC_14f64.dir/testCCompiler.c.obj 
      /Users/freewolf/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc   -march=rv32imc_zicsr_zifencei  -ffunction-sections -fdata-sections --target=riscv32imc_zicsr_zifencei-esp-espidf -o CMakeFiles/cmTC_14f64.dir/testCCompiler.c.obj -c /Users/freewolf/Documents/Study/esp32/rust-esp32-std-demo/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-c19c902b3a01e135/out/build/CMakeFiles/CMakeScratch/TryCompile-Z3g5Ka/testCCompiler.c
      riscv32-esp-elf-gcc: error: unrecognized command-line option '--target=riscv32imc_zicsr_zifencei-esp-espidf'
      ninja: build stopped: subcommand failed.

    CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
    /Users/freewolf/esp/esp-idf-v5.1.2/tools/cmake/project.cmake:448 (__project)
    CMakeLists.txt:28 (project)

  thread 'main' panicked at /Users/freewolf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

  command did not execute successfully, got: exit status: 1

  build script failed, must exit now
  stack backtrace:
     0:        0x1008bf100 - std::backtrace_rs::backtrace::libunwind::trace::hf31be3f818d9ed00
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
     1:        0x1008bf100 - std::backtrace_rs::backtrace::trace_unsynchronized::h43791251ae36a4a2
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:        0x1008bf100 - std::sys_common::backtrace::_print_fmt::h6a8db623e275b761
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:68:5
     3:        0x1008bf100 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hab3f53d2d8212ddd
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:44:22
     4:        0x1008e00f0 - core::fmt::rt::Argument::fmt::h49ac425c489e0e81
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/fmt/rt.rs:142:9
     5:        0x1008e00f0 - core::fmt::write::h0d0a687663f48932
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/fmt/mod.rs:1120:17
     6:        0x1008bb92c - std::io::Write::write_fmt::h79b31fb1b26d1d26
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/io/mod.rs:1846:15
     7:        0x1008bef3c - std::sys_common::backtrace::_print::h877abff9a10ed7d5
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:47:5
     8:        0x1008bef3c - std::sys_common::backtrace::print::h63e6d322e19f4801
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:34:9
     9:        0x1008c0a34 - std::panicking::default_hook::{{closure}}::h9349ab3cdb5da91c
    10:        0x1008c0718 - std::panicking::default_hook::h38cfb5d7f682af71
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:292:9
    11:        0x1008c1328 - std::panicking::rust_panic_with_hook::hba6149685af3b41f
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:779:13
    12:        0x1008c0d14 - std::panicking::begin_panic_handler::{{closure}}::h43fe5d8d89dcb2a4
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:657:13
    13:        0x1008bf58c - std::sys_common::backtrace::__rust_end_short_backtrace::h85585bc7dd9092f8
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:171:18
    14:        0x1008c0a8c - rust_begin_unwind
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:645:5
    15:        0x1009080d4 - core::panicking::panic_fmt::hfbac5bdaf98aee43
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/panicking.rs:72:14
    16:        0x100283874 - cmake::fail::h5db25ff65d9b68c4
                                 at /Users/freewolf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
    17:        0x1002831b8 - cmake::run::hca6e3622291b73ba
                                 at /Users/freewolf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1076:9
    18:        0x10027fd48 - cmake::Config::build::h17df2025a4f911f2
                                 at /Users/freewolf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:813:13
    19:        0x1000d9e30 - build_script_build::native::cargo_driver::build::h044e6ebc7435ec2f
                                 at /Users/freewolf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-sys-0.34.0/build/native/cargo_driver.rs:528:5
    20:        0x1000d1f1c - build_script_build::native::build::hf1d2465515a6d6b1
                                 at /Users/freewolf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-sys-0.34.0/build/native.rs:17:9
    21:        0x100087abc - build_script_build::main::haec2aaa2166e3d97
                                 at /Users/freewolf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-sys-0.34.0/build/build.rs:51:24
    22:        0x100094000 - core::ops::function::FnOnce::call_once::h83c268aef71e89b6
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/ops/function.rs:250:5
    23:        0x10007fbb8 - std::sys_common::backtrace::__rust_begin_short_backtrace::hca09ceea5701b8cf
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:155:18
    24:        0x1000cb314 - std::rt::lang_start::{{closure}}::hc05a13efd896631f
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/rt.rs:166:18
    25:        0x1008b51ac - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::he7b3aebdedbc76e4
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/ops/function.rs:284:13
    26:        0x1008b51ac - std::panicking::try::do_call::h8d52929609f53259
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:552:40
    27:        0x1008b51ac - std::panicking::try::h51c6c23974b0bcbc
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:516:19
    28:        0x1008b51ac - std::panic::catch_unwind::h3e35eaf2ac664468
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panic.rs:142:14
    29:        0x1008b51ac - std::rt::lang_start_internal::{{closure}}::h615c6957e394eda3
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/rt.rs:148:48
    30:        0x1008b51ac - std::panicking::try::do_call::h6c4397c1b6e40452
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:552:40
    31:        0x1008b51ac - std::panicking::try::h191672f52058d3ff
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:516:19
    32:        0x1008b51ac - std::panic::catch_unwind::hf2b4895f6ab5c456
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panic.rs:142:14
    33:        0x1008b51ac - std::rt::lang_start_internal::h91d67f00e21ccd3b
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/rt.rs:148:20
    34:        0x1000cb2e0 - std::rt::lang_start::heb425c698ab7d5bb
                                 at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/rt.rs:165:17
    35:        0x10008a6d8 - _main
ivmarkov commented 6 months ago
  1. Deactivate the ESP IDF you have activated
  2. Remove ALL environment variables related to ESP IDF, like IDF_PATH
  3. Follow the build instructions / prerequisites here and do not invent extra setup from somewhere else.