esp-rs / embedded-svc

Rust APIs and abstractions for various embedded services (WiFi, Network, Httpd, Logging, etc.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build error in v0.21.2 for target riscv32imc-esp-espidf

ericvrp opened this issue · comments

While trying to build https://github.com/ivmarkov/rust-esp32-std-demo I get this error

   Compiling embedded-svc v0.21.2
error[E0309]: the parameter type `S` may not live long enough
   --> /Users/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-svc-0.21.2/src/utils/asyncs/signal.rs:276:11
    |
276 |         = impl Future<Output = Result<T, Self::Error>> + Send;
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider adding an explicit lifetime bound `S: 's`...
    = note: ...so that the type `S` will meet its required lifetime bounds...
note: ...that is required by this bound
   --> /Users/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-svc-0.21.2/src/utils/asyncs/signal.rs:219:40
    |
219 |     pub struct SignalChannel<'a, S, T>(&'a S)
    |                                        ^^^^^

For more information about this error, try `rustc --explain E0309`.

Can you try building with latest master branch (i.e., by patching the embedded-svc dependency using patch.crates-io)?

Your problem should be fixed by 3b18835

If you confirm it does compile, I'll release V0.21.3 shortly.

Yes!

adding
embedded-svc = { git = "https://github.com/esp-rs/embedded-svc" }
to
[patch.crates-io]
fixed it.

commented

It does compile as long as you don't use esp-idf-svc experimental features

commented

I did

adding embedded-svc = { git = "https://github.com/esp-rs/embedded-svc" }

and get this.

error[E0432]: unresolved import `embedded_svc::utils::atomic_swap`
   --> /home/proben/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/esp-idf-svc-0.41.3/src/timer.rs:240:30
    |
240 |     use embedded_svc::utils::atomic_swap::AtomicOption;
    |                              ^^^^^^^^^^^ could not find `atomic_swap` in `utils`

error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied
   --> /home/proben/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/esp-idf-svc-0.41.3/src/timer.rs:243:53
    |
243 |         type AsyncWrapper<S> = AsyncTimerService<S, AtomicSignal<AtomicOption, ()>>;
    |                                                     ^^^^^^^^^^^^               -- help: remove this generic argument
    |                                                     |
    |                                                     expected 1 generic argument
    |
note: struct defined here, with 1 generic parameter: `T`
   --> /home/proben/.cargo/git/checkouts/embedded-svc-6d88e13f1ab219bd/1f8cec0/src/utils/asyncs/signal.rs:129:16
    |
129 |     pub struct AtomicSignal<T> {
    |                ^^^^^^^^^^^^ -

Some errors have detailed explanations: E0107, E0432.
For more information about an error, try `rustc --explain E0107`.
error: could not compile `esp-idf-svc` due to 2 previous errors
commented

I did

adding embedded-svc = { git = "https://github.com/esp-rs/embedded-svc" }

and get this.

error[E0432]: unresolved import `embedded_svc::utils::atomic_swap`
   --> /home/proben/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/esp-idf-svc-0.41.3/src/timer.rs:240:30
    |
240 |     use embedded_svc::utils::atomic_swap::AtomicOption;
    |                              ^^^^^^^^^^^ could not find `atomic_swap` in `utils`

error[E0107]: this struct takes 1 generic argument but 2 generic arguments were supplied
   --> /home/proben/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/esp-idf-svc-0.41.3/src/timer.rs:243:53
    |
243 |         type AsyncWrapper<S> = AsyncTimerService<S, AtomicSignal<AtomicOption, ()>>;
    |                                                     ^^^^^^^^^^^^               -- help: remove this generic argument
    |                                                     |
    |                                                     expected 1 generic argument
    |
note: struct defined here, with 1 generic parameter: `T`
   --> /home/proben/.cargo/git/checkouts/embedded-svc-6d88e13f1ab219bd/1f8cec0/src/utils/asyncs/signal.rs:129:16
    |
129 |     pub struct AtomicSignal<T> {
    |                ^^^^^^^^^^^^ -

Some errors have detailed explanations: E0107, E0432.
For more information about an error, try `rustc --explain E0107`.
error: could not compile `esp-idf-svc` due to 2 previous errors

It should be written like this

embedded-svc = { git = "https://github.com/esp-rs/embedded-svc" ,rev = "3b18835"}
commented

It should be written like this

embedded-svc = { git = "https://github.com/esp-rs/embedded-svc" ,rev = "3b18835"}

Well, It works.

I've released 0.21.3 now.

FYI @ivmarkov : this is still affecting dependent esp-rs crates, including at least esp-idf-svc and esp-idf-hal which require 0.21.2 specifically!

FYI @ivmarkov : this is still affecting dependent esp-rs crates, including at least esp-idf-svc and esp-idf-hal which require 0.21.2 specifically!

Are they? If you do cargo update the problem should be gone.

@ivmarkov 0.21.2 still shows as the latest on crates.io...

Thanks for the tip though, I needed to go over how Cargo handles deps for sure!

@ivmarkov 0.21.2 still shows as the latest on crates.io...

Thanks for the tip though, I needed to go over how Cargo handles deps for sure!

Huh, you are right... I've triggered republishing, this time it should be OK.