Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS std Development Environment Setup Errors #361

Open
apollolabsdev opened this issue Feb 8, 2024 · 6 comments
Open

macOS std Development Environment Setup Errors #361

apollolabsdev opened this issue Feb 8, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@apollolabsdev
Copy link

apollolabsdev commented Feb 8, 2024

This is an issue I faced setting up an environment for std development on a macOS.

This is on a Macbook Air with an M2 chip and Ventura 13.0.

The steps from the Rust ESP book here and here were followed. In addition to the linked steps for macOS highlighted on the Espressif website here.

I used cargo-generate to create a new project then ran cargo build without any modifications. The below error resulted. From the look of it, it appeared like the ESP-IDF necessary components were not being found. I verified that the environment variables were set up as required by the instructions and checked the relevant files. However, after much tinkering the code would only build successfully if I setup ESP_IDF_TOOLS_INSTALL_DIR = "global" under [env] in config.toml.

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

Caused by:
  process didn't exit successfully: `/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/target/debug/build/esp-idf-sys-eed4e9c9a8eb67e0/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
  IDF_PYTHON_ENV_PATH=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/python_env/idf5.1_py3.12_env
  ESP_IDF_VERSION=5.1
  PATH=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/ninja/1.10.2/:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/python_env/idf5.1_py3.12_env/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools:$PATH
  IDF_DEACTIVATE_FILE_PATH=/var/folders/0d/5g4dzlsj6gs05rq71bc62s_80000gn/T/tmp4qlowc_zidf_47983
  Current system platform: macos-arm64
  Skipping [email protected]_20230208 (already installed)
  Skipping [email protected] (already installed)
  Skipping [email protected] (already installed)
  IDF_PYTHON_ENV_PATH=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/python_env/idf5.1_py3.12_env
  ESP_IDF_VERSION=5.1
  PATH=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/ninja/1.10.2/:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/python_env/idf5.1_py3.12_env/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools:$PATH
  IDF_DEACTIVATE_FILE_PATH=/var/folders/0d/5g4dzlsj6gs05rq71bc62s_80000gn/T/tmpvzl22kl1idf_47983
  cargo:rerun-if-changed=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/sdkconfig.defaults
  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/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-6d495f87e907f1a6/out/build" && CMAKE_PREFIX_PATH="" EXTRA_COMPONENT_DIRS="" IDF_COMPONENT_MANAGER="1" IDF_PATH="/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2" IDF_TARGET="esp32c3" IDF_TOOLS_PATH="/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif" PATH="/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/python_env/idf5.1_py3.12_env/bin:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools:/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/tools/ninja/1.10.2/:/opt/homebrew/opt/llvm/bin:/Users/omarhiari/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/homebrew/opt/llvm/bin:/Users/omarhiari/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/omarhiari/.cargo/bin" PROJECT_DIR="/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping" SDKCONFIG_DEFAULTS="/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-6d495f87e907f1a6/out/gen-sdkconfig.defaults;/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/sdkconfig.defaults" "cmake" "/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-6d495f87e907f1a6/out" "-G" "Ninja" "-DCMAKE_TOOLCHAIN_FILE=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/toolchain-esp32c3.cmake" "-DCMAKE_BUILD_TYPE=" "-DPYTHON=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/python_env/idf5.1_py3.12_env/bin/python" "-DCMAKE_INSTALL_PREFIX=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-6d495f87e907f1a6/out" "-DCMAKE_C_FLAGS= -march=rv32imc_zicsr_zifencei -ffunction-sections -fdata-sections -march=rv32imc_zicsr_zifencei -mabi=ilp32 -mcmodel=medany" "-DCMAKE_CXX_FLAGS= -march=rv32imc_zicsr_zifencei -ffunction-sections -fdata-sections -march=rv32imc_zicsr_zifencei -mabi=ilp32 -mcmodel=medany" "-DCMAKE_ASM_FLAGS=  -ffunction-sections -fdata-sections -march=rv32imc_zicsr_zifencei -mabi=ilp32 -mcmodel=medany"
  -- Building ESP-IDF components for target esp32c3
  -- Checking Python dependencies...
  Python requirements are satisfied.
  Constraint file: /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/espidf.constraints.v5.1.txt
  Requirement files:
   - /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/requirements/requirements.core.txt
  Python being checked: /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/python_env/idf5.1_py3.12_env/bin/python
  -- Configuring incomplete, errors occurred!
  See also "/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-6d495f87e907f1a6/out/build/CMakeFiles/CMakeOutput.log".

  --- stderr
  Build configuration: BuildConfig {
      esp_idf_tools_install_dir: None,
      esp_idf_sdkconfig: None,
      esp_idf_sdkconfig_defaults: None,
      mcu: Some(
          "esp32c3",
      ),
      native: NativeConfig {
          esp_idf_version: Some(
              Tag(
                  "v5.1.2",
              ),
          ),
          esp_idf_repository: None,
          esp_idf_cmake_generator: None,
          idf_path: None,
          extra_components: [],
          esp_idf_components: None,
          esp_idf_component_manager: None,
      },
      esp_idf_sys_root_crate: None,
  }
  Using managed esp-idf repository: RemoteSdk { repo_url: None, git_ref: Tag("v5.1.2") }
  Using esp-idf v5.1.2 at '/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2'
  CMake Warning at /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/git_submodules.cmake:52 (message):
    Git submodule
    components/bootloader/subproject/components/micro-ecc/micro-ecc is out of
    date.  Run 'git submodule update --init --recursive' to fix.
  Call Stack (most recent call first):
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/build.cmake:80 (git_submodule_check)
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/build.cmake:240 (__build_get_idf_git_revision)
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/idf.cmake:53 (__build_init)
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/project.cmake:29 (include)
    CMakeLists.txt:10 (include)


  CMake Warning at /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/git_submodules.cmake:52 (message):
    Git submodule components/bt/controller/lib_esp32 is out of date.  Run 'git
    submodule update --init --recursive' to fix.
  Call Stack (most recent call first):
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/build.cmake:80 (git_submodule_check)
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/build.cmake:240 (__build_get_idf_git_revision)
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/idf.cmake:53 (__build_init)
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/project.cmake:29 (include)
    CMakeLists.txt:10 (include)

Then several similar out of date git submodule warnings followed by:

  CMake Error at /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/component.cmake:224 (message):
    CMake Warning (dev) at build_properties.temp.cmake:8:

      Syntax Warning in cmake code at column 47   

      Argument not separated from preceding token by whitespace.

    Call Stack (most recent call first):

      /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/scripts/component_get_requirements.cmake:3 (include)

    This warning is for project developers.  Use -Wno-dev to suppress it.


    CMake Error at
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/components/mqtt/CMakeLists.txt:3
    (message):

      Missing esp-mqtt submodule.  Please run 'git submodule update --init
      --recursive' in ESP-IDF directory to fix this.

    Call Stack (most recent call first):

      /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/scripts/component_get_requirements.cmake:106 (include)
      /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/scripts/component_get_requirements.cmake:124 (__component_get_requirements)

 
  Call Stack (most recent call first):
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/build.cmake:574 (__component_get_requirements)
    /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/ping/.embuild/espressif/esp-idf/v5.1.2/tools/cmake/project.cmake:547 (idf_build_process)
    CMakeLists.txt:28 (project)


  thread 'main' panicked at /Users/omarhiari/.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
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@apollolabsdev
Copy link
Author

I edited the original comment to reflect the accurate configuration as I made an error before in the configuration name. The name I stated, in the beginning, was ESP_IDF_VERSION while the correct one is ESP_IDF_TOOLS_INSTALL_DIR.

@SergioGasquez SergioGasquez transferred this issue from esp-rs/rust-build Feb 12, 2024
@Vollbrecht
Copy link
Collaborator

You should not need to set ESP_IDF_TOOLS_INSTALL_DIR . The first thing you should try is to rm -rf .embuild inside your project dir as a failed pull of esp-idf from github could lead to such a thing you were observing. The same logic apply if you use ESP_IDF_TOOLS_INSTALL_DIR and point it to a now project independent global install dir. If you run cargo b it will install esp-idf for you automatically, eithere in the local project dir inside .embuild or inside a global dir if you are using that env var. The ESP_IDF_VERSION env var is needed and sets what version of esp-idf is gonna be installed/used by your project.

@apollolabsdev
Copy link
Author

apollolabsdev commented Feb 12, 2024

Yes, I forgot to mention that though, I did delete .embuild and ran cargo clean several times before running cargo build again. All ending up with the same result. ESP_IDF_VERSION is already set under [env] from the original cargo generate project but it won't work until ESP_IDF_TOOLS_INSTALL_DIR is set.

@apollolabsdev
Copy link
Author

apollolabsdev commented Feb 21, 2024

Has anything changed recently on the cargo generate template? This issue has appeared all over again regardless of the ESP_IDF_TOOLS_INSTALL_DIR option I used. I delete .embuild and run a cargo clean before each build everytime I do a change.

Update:
It seems to be a different issue, however, it happens only with newly spawned projects using cargo generate. Older projects still build ok. I've done an uninstall/reinstall of tools, but it didn't help. Here's the error output:

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

Caused by:
  process didn't exit successfully: `/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/debug/build/esp-idf-sys-ef9aa1591ed6faa4/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
  IDF_PYTHON_ENV_PATH=/Users/omarhiari/.espressif/python_env/idf5.1_py3.12_env
  ESP_IDF_VERSION=5.1
  PATH=/Users/omarhiari/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Users/omarhiari/.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/omarhiari/.espressif/tools/ninja/1.10.2/:/Users/omarhiari/.espressif/python_env/idf5.1_py3.12_env/bin:/Users/omarhiari/.espressif/esp-idf/v5.1.2/tools:$PATH
  IDF_DEACTIVATE_FILE_PATH=/var/folders/0d/5g4dzlsj6gs05rq71bc62s_80000gn/T/tmpa8f6xlhtidf_73781
  Current system platform: macos-arm64
  Skipping [email protected]_20230208 (already installed)
  Skipping [email protected] (already installed)
  Skipping [email protected] (already installed)
  IDF_PYTHON_ENV_PATH=/Users/omarhiari/.espressif/python_env/idf5.1_py3.12_env
  ESP_IDF_VERSION=5.1
  PATH=/Users/omarhiari/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Users/omarhiari/.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/omarhiari/.espressif/tools/ninja/1.10.2/:/Users/omarhiari/.espressif/python_env/idf5.1_py3.12_env/bin:/Users/omarhiari/.espressif/esp-idf/v5.1.2/tools:$PATH
  IDF_DEACTIVATE_FILE_PATH=/var/folders/0d/5g4dzlsj6gs05rq71bc62s_80000gn/T/tmpqtw0bbavidf_73781
  cargo:rerun-if-changed=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/sdkconfig.defaults
  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/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/out/build" && CMAKE_PREFIX_PATH="" EXTRA_COMPONENT_DIRS="" IDF_COMPONENT_MANAGER="1" IDF_PATH="/Users/omarhiari/.espressif/esp-idf/v5.1.2" IDF_TARGET="esp32c3" IDF_TOOLS_PATH="/Users/omarhiari/.espressif" PATH="/Users/omarhiari/.espressif/python_env/idf5.1_py3.12_env/bin:/Users/omarhiari/.espressif/esp-idf/v5.1.2/tools:/Users/omarhiari/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/Users/omarhiari/.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/Users/omarhiari/.espressif/tools/ninja/1.10.2/:/Users/omarhiari/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/opt/homebrew/opt/llvm/bin:/Users/omarhiari/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/omarhiari/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/opt/homebrew/opt/llvm/bin:/Users/omarhiari/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/omarhiari/.cargo/bin" PROJECT_DIR="/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing" SDKCONFIG_DEFAULTS="/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/out/gen-sdkconfig.defaults;/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/sdkconfig.defaults" "cmake" "/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/out" "-G" "Ninja" "-DCMAKE_TOOLCHAIN_FILE=/Users/omarhiari/.espressif/esp-idf/v5.1.2/tools/cmake/toolchain-esp32c3.cmake" "-DCMAKE_BUILD_TYPE=" "-DPYTHON=/Users/omarhiari/.espressif/python_env/idf5.1_py3.12_env/bin/python" "-DCMAKE_INSTALL_PREFIX=/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/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"
  -- Found Git: /opt/homebrew/bin/git (found version "2.43.0") 
  -- 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/omarhiari/.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/omarhiari/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
  -- Check for working C compiler: /Users/omarhiari/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc - broken
  -- Configuring incomplete, errors occurred!
  See also "/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/out/build/CMakeFiles/CMakeOutput.log".
  See also "/Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  Build configuration: BuildConfig {
      esp_idf_tools_install_dir: Some(
          Global,
      ),
      esp_idf_sdkconfig: None,
      esp_idf_sdkconfig_defaults: None,
      mcu: Some(
          "esp32c3",
      ),
      native: NativeConfig {
          esp_idf_version: Some(
              Tag(
                  "v5.1.2",
              ),
          ),
          esp_idf_repository: None,
          esp_idf_cmake_generator: None,
          idf_path: None,
          extra_components: [],
          esp_idf_components: None,
          esp_idf_component_manager: None,
      },
      esp_idf_sys_root_crate: None,
  }
  Using managed esp-idf repository: RemoteSdk { repo_url: None, git_ref: Tag("v5.1.2") }
  Using esp-idf v5.1.2 at '/Users/omarhiari/.espressif/esp-idf/v5.1.2'
  CMake Error at /Users/omarhiari/.espressif/tools/cmake/3.24.0/CMake.app/Contents/share/cmake-3.24/Modules/CMakeTestCCompiler.cmake:69 (message):
    The C compiler

      "/Users/omarhiari/.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/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/out/build/CMakeFiles/CMakeTmp
      
      Run Build Command(s):/Users/omarhiari/.espressif/tools/ninja/1.10.2/ninja cmTC_3b013 && [1/2] Building C object CMakeFiles/cmTC_3b013.dir/testCCompiler.c.obj
      FAILED: CMakeFiles/cmTC_3b013.dir/testCCompiler.c.obj 
      /Users/omarhiari/.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_3b013.dir/testCCompiler.c.obj -c /Users/omarhiari/Documents/GitHub/ESP32C3/std_examples/testing/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-42f9ffb44951243c/out/build/CMakeFiles/CMakeTmp/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/omarhiari/.espressif/esp-idf/v5.1.2/tools/cmake/project.cmake:448 (__project)
    CMakeLists.txt:28 (project)


  thread 'main' panicked at /Users/omarhiari/.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
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@juliankrieger
Copy link

juliankrieger commented Apr 2, 2024

@apollolabsdev Currently, you need to set the following option in your .cargo/config file, inside the [env] block.

CRATE_CC_NO_DEFAULTS="1"

This is a bug in CC. You can try to use the upstream version and see it it's fixed there via

[patch.crates-io]
cc = { git = "https://github.com/rust-lang/cc-rs" }

@apollolabsdev
Copy link
Author

Awesome, it works!
I was getting by using the 4.4 version of the ESP-IDF as I didn't face the same issue there.

@Vollbrecht Vollbrecht added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

3 participants