esp-rs / esp-hal

no_std Hardware Abstraction Layers for ESP32 microcontrollers
https://docs.esp-rs.org/esp-hal/
Apache License 2.0
753 stars 211 forks source link

Cannot build esp-wifi. toml_cfg errors #1866

Closed therealchfkch closed 3 months ago

therealchfkch commented 3 months ago

As is was cloning the examples in the training from https://github.com/esp-rs/no_std-training I noticed the build fails with the following errors https://pastebin.com/MdC9vMFC.

Short form of some symptomatic error messages here:

Compiling esp-wifi v0.7.1
error[E0463]: can't find crate for `toml_cfg`
  --> /home/xxxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.7.1/src/lib.rs:72:3
   |
72 | #[toml_cfg::toml_config]
   |   ^^^^^^^^ can't find crate

error: cannot determine resolution for the attribute macro `toml_cfg::toml_config`
  --> /home/xxxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.7.1/src/lib.rs:72:3
   |
72 | #[toml_cfg::toml_config]
   |   ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `default` in this scope
  --> /home/xxxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.7.1/src/lib.rs:75:7
   |
75 |     #[default(5)]
   |       ^^^^^^^

rror[E0425]: cannot find value `CONFIG` in the crate root
   --> /home/xxxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.7.1/src/wifi/mod.rs:664:37
    |
664 | const RX_QUEUE_SIZE: usize = crate::CONFIG.rx_queue_size;
    |                                     ^^^^^^ not found in the crate root

error[E0425]: cannot find value `CONFIG` in the crate root
   --> /home/xxxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.7.1/src/wifi/mod.rs:665:37
    |
665 | const TX_QUEUE_SIZE: usize = crate::CONFIG.tx_queue_size;
    |                                     ^^^^^^ not found in the crate root

error[E0425]: cannot find value `CONFIG` in the crate root
    --> /home/xxxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-wifi-0.7.1/src/wifi/mod.rs:1064:31
     |
1064 |     static_rx_buf_num: crate::CONFIG.static_rx_buf_num as i32,
     |                               ^^^^^^ not found in the crate root

I also tried using the cargo-generate template, which produces the same output.

Board used: ESP32C6 (but i also tried just to build with C3 board configured) Channel: nightly and nightly-2023-11-14 (as it was a preset in the example.

I suspect somehow the build dependency is not properly included, but it is declared here: https://github.com/esp-rs/esp-hal/blob/237804efb602fe22542be36c90c919efc14879fd/esp-wifi/Cargo.toml#L56

Am i doing something wrong while building? I followed all the books and tutorials i found. Everything else works as suspected, except when i include esp-wifi in the project. "Normal" projects work on both C6 and C3 boards previously.

bjoernQ commented 3 months ago

Most probably something messed up you Cargo cache - you could use e.g. cargo-cache to clean-up or manually clean things in $HOME/.cargo

therealchfkch commented 3 months ago

I did now both clear with cargo-cache and manually, but the outcome is still the same. Can you confirm that you can build the wifi_embassy_dhcp or wifi_dhcpexample? So i can be sure it is a problem on my end and not the upstream repo.

bjoernQ commented 3 months ago

Yes, it builds fine. We also build all examples in CI so we should always be sure all examples are always buildable

Build log ``` ❯ cargo xtask run-example examples esp32c6 wifi_embassy_dhcp Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s Running `target\debug\xtask.exe run-example examples esp32c6 wifi_embassy_dhcp` [2024-07-29T07:50:42Z INFO xtask] Building example 'C:\projects\esp\esp-hal\examples\src\bin\wifi_embassy_dhcp.rs' for 'esp32c6' [2024-07-29T07:50:42Z INFO xtask] Features: async,embassy,embassy-generic-timers,esp-wifi,esp-wifi/async,esp-wifi/embassy-net,esp-wifi/wifi-default,esp-wifi/wifi,esp-wifi/utils [2024-07-29T07:50:42Z INFO xtask] Package: "src\\bin\\wifi_embassy_dhcp.rs" Compiling compiler_builtins v0.1.109 Compiling core v0.0.0 (C:\Users\Bjoern\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core) Compiling proc-macro2 v1.0.86 Compiling unicode-ident v1.0.12 Compiling version_check v0.9.4 Compiling windows_x86_64_msvc v0.52.6 Compiling typenum v1.17.0 Compiling portable-atomic v1.6.0 Compiling strsim v0.11.1 Compiling serde v1.0.204 Compiling rustversion v1.0.17 Compiling anyhow v1.0.86 Compiling heck v0.5.0 Compiling cfg-if v1.0.0 Compiling utf8parse v0.2.2 Compiling anstyle v1.0.7 Compiling windows-targets v0.52.6 Compiling windows-sys v0.52.0 Compiling anstyle-parse v0.2.4 Compiling generic-array v0.14.7 Compiling heapless v0.8.0 Compiling syn v1.0.109 Compiling is_terminal_polyfill v1.70.0 Compiling colorchoice v1.0.1 Compiling fnv v1.0.7 Compiling ident_case v1.0.1 Compiling clap_lex v0.7.1 Compiling equivalent v1.0.1 Compiling hashbrown v0.14.5 Compiling embedded-io-async v0.6.1 Compiling lazy_static v1.5.0 Compiling proc-macro-error-attr v1.0.4 Compiling quote v1.0.36 Compiling litrs v0.4.1 Compiling proc-macro-error v1.0.4 Compiling embedded-hal-async v1.0.0 Compiling embassy-sync v0.5.0 Compiling syn v2.0.71 Compiling static_assertions v1.1.0 Compiling semver v1.0.23 Compiling indexmap v2.2.6 Compiling adler v1.0.2 Compiling twox-hash v1.6.3 Compiling crc32fast v1.4.2 Compiling miniz_oxide v0.7.4 Compiling winapi-util v0.1.8 Compiling anstyle-wincon v3.0.3 Compiling anstyle-query v1.1.0 Compiling termcolor v1.4.1 Compiling anstream v0.6.14 Compiling winnow v0.5.40 Compiling riscv v0.11.1 Compiling document-features v0.2.10 Compiling byteorder v1.5.0 Compiling flate2 v1.0.30 Compiling ruzstd v0.7.0 Compiling clap_builder v4.5.10 Compiling embassy-sync v0.6.0 Compiling paste v1.0.15 Compiling embassy-time-driver v0.1.0 Compiling esp32c6 v0.15.0 Compiling memchr v2.7.4 Compiling rustc_version v0.4.0 Compiling winnow v0.6.13 Compiling autocfg v1.3.0 Compiling az v1.2.1 Compiling object v0.36.1 Compiling heapless v0.7.17 Compiling num-traits v0.2.19 Compiling esp-wifi-sys v0.4.0 Compiling embassy-time-queue-driver v0.1.0 Compiling atomic-polyfill v1.0.3 Compiling embassy-sync v0.3.0 Compiling heck v0.4.1 Compiling smoltcp v0.11.0 Compiling embassy-executor v0.5.0 Compiling embedded-nal-async v0.7.1 Compiling libm v0.2.8 Compiling litrs v0.2.3 Compiling embedded-hal-bus v0.2.0 Compiling uuid v1.9.1 Compiling embassy-usb v0.2.0 Compiling esp-ieee802154 v0.1.0 (C:\projects\esp\esp-hal\esp-ieee802154) Compiling examples v0.0.0 (C:\projects\esp\esp-hal\examples) Compiling darling_core v0.20.10 Compiling riscv-rt-macros v0.2.1 Compiling hash32-derive v0.1.1 Compiling bleps-macros v0.1.0 (https://github.com/bjoernQ/bleps?rev=a5148d8ae679e021b78f53fd33afb8bb35d0b62e#a5148d8a) Compiling serde_derive v1.0.204 Compiling esp-build v0.1.0 (C:\projects\esp\esp-hal\esp-build) Compiling futures-macro v0.3.30 Compiling strum_macros v0.26.4 Compiling clap_derive v4.5.8 Compiling delegate v0.12.0 Compiling portable_atomic_enum_macros v0.2.1 Compiling num_enum_derive v0.7.2 Compiling darling_macro v0.20.10 Compiling num-derive v0.4.2 Compiling esp-println v0.10.0 (C:\projects\esp\esp-hal\esp-println) Compiling esp-backtrace v0.13.0 (C:\projects\esp\esp-hal\esp-backtrace) Compiling darling v0.20.10 Compiling enumset_derive v0.8.1 Compiling embassy-executor-macros v0.4.1 Compiling bleps-dedup v0.1.0 (https://github.com/bjoernQ/bleps?rev=a5148d8ae679e021b78f53fd33afb8bb35d0b62e#a5148d8a) Compiling strum v0.26.3 Compiling clap v4.5.10 Compiling rustc-std-workspace-core v1.99.0 (C:\Users\Bjoern\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core) Compiling alloc v0.0.0 (C:\Users\Bjoern\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc) Compiling basic-toml v0.1.9 Compiling toml_datetime v0.6.6 Compiling serde_spanned v0.6.6 Compiling toml_edit v0.21.1 Compiling toml_edit v0.22.14 Compiling esp-metadata v0.2.0 (C:\projects\esp\esp-hal\esp-metadata) Compiling zeroize v1.8.1 Compiling critical-section v1.1.2 Compiling stable_deref_trait v1.2.0 Compiling nb v1.1.0 Compiling futures-sink v0.3.30 Compiling pin-utils v0.1.0 Compiling futures-task v0.3.30 Compiling pin-project-lite v0.2.14 Compiling subtle v2.6.1 Compiling embedded-io v0.6.1 Compiling embedded-hal v1.0.0 Compiling rand_core v0.6.4 Compiling hash32 v0.3.1 Compiling void v1.0.2 Compiling esp-hal v0.19.0 (C:\projects\esp\esp-hal\esp-hal) Compiling log v0.4.22 Compiling bytemuck v1.16.1 Compiling nb v0.1.3 Compiling embassy-futures v0.1.1 Compiling embassy-usb-driver v0.1.0 Compiling embedded-hal v0.2.7 Compiling hash32 v0.2.1 Compiling vcell v0.1.3 Compiling gcd v2.3.0 Compiling const-oid v0.9.6 Compiling futures-core v0.3.30 Compiling futures-util v0.3.30 Compiling proc-macro-crate v3.1.0 Compiling der v0.7.9 Compiling fugit v0.3.7 Compiling embedded-hal-nb v1.0.0 Compiling ff v0.13.0 Compiling embedded-can v0.4.1 Compiling enumset v1.1.3 Compiling bitfield v0.15.0 Compiling esp-riscv-rt v0.9.0 (C:\projects\esp\esp-hal\esp-riscv-rt) Compiling bitflags v2.6.0 Compiling base16ct v0.2.0 Compiling crypto-common v0.1.6 Compiling toml v0.8.14 Compiling crypto-bigint v0.5.5 Compiling cipher v0.3.0 Compiling group v0.13.0 Compiling no-std-net v0.6.0 Compiling embassy-net-driver v0.2.0 Compiling ctr v0.8.0 Compiling aead v0.4.3 Compiling block-buffer v0.10.4 Compiling futures-channel v0.3.30 Compiling generic-array v0.12.4 Compiling generic-array v0.13.3 Compiling rgb v0.8.40 Compiling esp-hal-embassy v0.2.0 (C:\projects\esp\esp-hal\esp-hal-embassy) Compiling sec1 v0.7.3 Compiling display-interface v0.4.1 Compiling managed v0.8.0 Compiling futures-io v0.3.30 Compiling bitflags v1.3.2 Compiling futures v0.3.30 Compiling embassy-usb-synopsys-otg v0.1.0 Compiling smart-leds-trait v0.3.0 Compiling as-slice v0.1.5 Compiling ccm v0.4.3 Compiling embedded-graphics-core v0.4.0 Compiling digest v0.10.7 Compiling embedded-nal v0.8.0 Compiling micromath v1.1.1 Compiling inout v0.1.3 Compiling as-slice v0.2.1 Compiling elliptic-curve v0.13.8 Compiling byte-slice-cast v0.3.5 Compiling linked_list_allocator v0.10.5 Compiling byte v0.2.7 Compiling accelerometer v0.12.0 Compiling embassy-time v0.3.1 Compiling display-interface-spi v0.4.1 Compiling ieee802154 v0.6.1 Compiling atomic-pool v1.0.1 Compiling primeorder v0.13.6 Compiling cipher v0.4.4 Compiling float-cmp v0.9.0 Compiling embassy-net-driver-channel v0.2.0 Compiling display-interface-i2c v0.4.0 Compiling usb-device v0.3.2 Compiling atomic-waker v1.1.2 Compiling portable_atomic_enum v0.3.1 Compiling bitfield v0.14.0 Compiling esp-hal-procmacros v0.12.0 (C:\projects\esp\esp-hal\esp-hal-procmacros) Compiling num_enum v0.7.2 Compiling micromath v2.1.0 Compiling lis3dh-async v0.9.3 Compiling bleps v0.1.0 (https://github.com/bjoernQ/bleps?rev=a5148d8ae679e021b78f53fd33afb8bb35d0b62e#a5148d8a) Compiling usbd-serial v0.2.2 Compiling embedded-graphics v0.8.1 Compiling aes v0.8.4 Compiling p192 v0.13.0 Compiling p256 v0.13.2 Compiling ssd1306 v0.8.4 Compiling embassy-net v0.4.0 Compiling esp-alloc v0.4.0 (C:\projects\esp\esp-hal\esp-alloc) Compiling toml-cfg v0.2.0 Compiling sha2 v0.10.8 Compiling hmac v0.12.1 Compiling smart-leds v0.4.0 Compiling static_cell v2.1.0 Compiling embedded-storage v0.3.1 Compiling hex-literal v0.4.1 Compiling esp-wifi v0.7.1 (C:\projects\esp\esp-hal\esp-wifi) Compiling esp-hal-smartled v0.12.0 (C:\projects\esp\esp-hal\esp-hal-smartled) Finished `release` profile [optimized + debuginfo] target(s) in 53.73s Running `espflash flash --monitor target\riscv32imac-unknown-none-elf\release\wifi_embassy_dhcp` ```
therealchfkch commented 3 months ago

Okay, thanks so far. Maybe i will check it out on another machine then.

therealchfkch commented 3 months ago

Hhm on my Alpine/PMOS phone it builds, seems to be a NixOS or configuration problem on my side then. Should i close it or leave it open for discussion?

bjoernQ commented 3 months ago

I'll close this for now but feel free to add any relevant information so anyone else running into a similar issue will be able to find additional information here. Thanks