esp-rs/esp-idf-template

wsl2 dev container broken

Opened this issue · 1 comments

Bug description

  • Would you like to work on a fix? [y/n]

no

To Reproduce

Steps to reproduce the behavior:

  1. cargo generate esp-rs/esp-idf-template cargo
  2. Which MCU to target? · esp32c3
  3. Configure advanced template options? · true
  4. ESP-IDF version (master = UNSTABLE) · v5.2
  5. Configure project to use Dev Containers (VS Code and GitHub Codespaces)? · true
  6. Configure project to support Wokwi simulation with Wokwi VS Code extension? · false
  7. Add CI files for GitHub Action? · false

Expected behavior

A working template with the options i choose

Screenshots

Environment

  • OS: Windows 11 (Version 10.0.22631 Build 22631)

Additional context

  • Fails mounting /run/udev which does not seem to be a thing in wsl which in my case i just replaced with /dev/bus/usb in the devcontainers runArgs, requires manually passing through the bus in windows but thats no big deal for me
  • Still generated the wokwi scripts and installed the extension despite saying no to it, the scripts dont work either:
/bin/bash: line 1: scripts/build.sh: cannot execute: required file not found
  • Rust analyzer doesnt work either cause its trying to use (presumibly) the container's architecture which is set as default toolchain:
  --- 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.2.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.2.2") }
  Using esp-idf v5.2.2 at '/home/esp/owie_c3/.embuild/espressif/esp-idf/v5.2.2'
  thread 'main' panicked at /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embuild-0.32.0/src/espidf.rs:153:33:
  Failed to run command: "/home/esp/owie_c3/.embuild/espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-gcc" "--version"
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/ee612c45f00391aff71ec0c52b7fc08fae18c711/library/std/src/panicking.rs:665:5
     1: core::panicking::panic_fmt
               at /rustc/ee612c45f00391aff71ec0c52b7fc08fae18c711/library/core/src/panicking.rs:76:14
     2: embuild::espidf::Tool::test::{{closure}}
               at /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embuild-0.32.0/src/espidf.rs:153:33
     3: core::result::Result<T,E>::unwrap_or_else
               at /home/esp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1458:23
     4: embuild::espidf::Tool::test
               at /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embuild-0.32.0/src/espidf.rs:150:22
     5: embuild::espidf::Installer::install::{{closure}}
               at /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embuild-0.32.0/src/espidf.rs:667:63
     6: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::all
               at /home/esp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:268:25
     7: embuild::espidf::Installer::install
               at /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embuild-0.32.0/src/espidf.rs:667:35
     8: build_script_build::native::cargo_driver::build::{{closure}}
               at ./build/native/cargo_driver.rs:163:23
     9: build_script_build::native::cargo_driver::build
               at ./build/native/cargo_driver.rs:210:17
    10: build_script_build::native::build
               at ./build/native.rs:17:9
    11: build_script_build::main
               at ./build/build.rs:51:24
    12: core::ops::function::FnOnce::call_once
               at /home/esp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


2024-11-20T19:28:23.310213273Z ERROR Flycheck failed to run the following command: CommandHandle { program: "/home/esp/.cargo/bin/cargo", arguments: ["clippy", "--workspace", "--message-format=json-diagnostic-rendered-ansi", "--manifest-path", "/home/esp/owie_c3/Cargo.toml", "--keep-going"], current_dir: Some("/home/esp/owie_c3") }, error=Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(256))):
error: 'cargo-clippy' is not installed for the custom toolchain '/home/esp/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu'.
note: this is a custom toolchain, which cannot use `rustup component add`
help: if you built this toolchain from source, and used `rustup toolchain link`, then you may be able to build the component with `x.py`
  • Building with cargo build --target riscv32imc-esp-espidf fails:
  Using esp-idf v5.2.2 at '/home/esp/owie_c3/.embuild/espressif/esp-idf/v5.2.2'
  thread 'main' panicked at /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embuild-0.32.0/src/espidf.rs:153:33:
  Failed to run command: "/home/esp/owie_c3/.embuild/espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-gcc" "--version"

I've worked with rust on my pico's before and expected this to be more or less painless as well but so far its a complete disaster and very frustrating, any help or proper instructions on how to get this running in wsl2 would be appreciated.

If you are willing to give it a try without containers, I can help along the way.

Otherwise, perhaps @SergioGasquez can help in here?