esp-rs / std-training

Embedded Rust on Espressif training material.
https://esp-rs.github.io/std-training
Apache License 2.0
606 stars 78 forks source link

error: unrecognized command-line option '--target=riscv32imc_zicsr_zifencei-esp-espidf #237

Closed tomvictor closed 7 months ago

tomvictor commented 7 months ago

I am trying to build the ´hardware-check´ sample program on mac os with M1 pro processor. I have followed the software installation described in the doc, then also tried to redo it exactly like in the Development docker container, but the issue still persist. Fortunately I am able to build successfully using the devcontainer.

It fails with the following output:

  Change Dir: /Users/dev_user/git/tom/std-training/intro/hardware-check/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-3cd462394fb85936/out/build/CMakeFiles/CMakeTmp

  Run Build Command(s):/Users/dev_user/.espressif/tools/ninja/1.10.2/ninja cmTC_1a10f && [1/2] Building C object CMakeFiles/cmTC_1a10f.dir/testCCompiler.c.obj
  FAILED: CMakeFiles/cmTC_1a10f.dir/testCCompiler.c.obj 
  /Users/dev_user/.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_1a10f.dir/testCCompiler.c.obj -c /Users/dev_user/git/tom/std-training/intro/hardware-check/target/riscv32imc-esp-espidf/debug/build/esp-idf-sys-3cd462394fb85936/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/dev_user/.espressif/esp-idf/v5.1.2/tools/cmake/project.cmake:448 (__project) CMakeLists.txt:28 (project)

thread 'main' panicked at /Users/dev_user/.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`

Really appreciate any suggestions

Thanks

Vollbrecht commented 7 months ago

this is most likely the same problem we are tracking here https://github.com/esp-rs/esp-idf-sys/issues/287 .

Can you try to build with the CRATE_CC_NO_DEFAULTS=1 env variable set? You can either directly provide it with CRATE_CC_NO_DEFAULTS=1 cargo build or set it in the projects .cargo/config.toml inside the [env] section

tomvictor commented 7 months ago

Thanks @Vollbrecht for the quick response, it is working perfectly fine now.