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

unresolved imports in target xtensa-esp32-espidf #1751

Closed
javoerro opened this issue Jan 2, 2024 · 7 comments
Closed

unresolved imports in target xtensa-esp32-espidf #1751

javoerro opened this issue Jan 2, 2024 · 7 comments

Comments

@javoerro
Copy link

javoerro commented Jan 2, 2024

While compiling async-nats v0.33.0 for target xtensa-esp32-espidf mio compile error emerges:

Compiling mio v0.8.10
error[E0432]: unresolved imports `self::selector::event`, `self::selector::Event`, `self::selector::Events`, `self::selector::Selector`
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/mod.rs:18:37
   |
18 |     pub(crate) use self::selector::{event, Event, Events, Selector};
   |                                     ^^^^^  ^^^^^  ^^^^^^  ^^^^^^^^ no `Selector` in `sys::unix::selector`
   |                                     |      |      |
   |                                     |      |      no `Events` in `sys::unix::selector`
   |                                     |      no `Event` in `sys::unix::selector`
   |                                     no `event` in `sys::unix::selector`
   |
   = help: consider importing this module instead:
           crate::event
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:21:30
   |
21 | pub(crate) use self::epoll::{event, Event, Events, Selector};
   |                              ^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:35:29
   |
35 | pub(crate) use self::poll::{event, Event, Events, Selector};
   |                             ^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:70:31
   |
70 | pub(crate) use self::kqueue::{event, Event, Events, Selector};
   |                               ^^^^^
   = help: consider importing this struct through its public re-export instead:
           crate::event::Event
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:21:37
   |
21 | pub(crate) use self::epoll::{event, Event, Events, Selector};
   |                                     ^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:35:36
   |
35 | pub(crate) use self::poll::{event, Event, Events, Selector};
   |                                    ^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:70:38
   |
70 | pub(crate) use self::kqueue::{event, Event, Events, Selector};
   |                                      ^^^^^
   = help: consider importing this struct through its public re-export instead:
           crate::Events
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:21:44
   |
21 | pub(crate) use self::epoll::{event, Event, Events, Selector};
   |                                            ^^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:35:43
   |
35 | pub(crate) use self::poll::{event, Event, Events, Selector};
   |                                           ^^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:70:45
   |
70 | pub(crate) use self::kqueue::{event, Event, Events, Selector};
   |                                             ^^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:21:52
   |
21 | pub(crate) use self::epoll::{event, Event, Events, Selector};
   |                                                    ^^^^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:35:51
   |
35 | pub(crate) use self::poll::{event, Event, Events, Selector};
   |                                                   ^^^^^^^^
note: found an item that was configured out
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/selector/mod.rs:70:53
   |
70 | pub(crate) use self::kqueue::{event, Event, Events, Selector};
   |                                                     ^^^^^^^^

error[E0412]: cannot find type `WakerInternal` in this scope
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/waker.rs:38:16
   |
38 |         waker: WakerInternal,
   |                ^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing this struct
   |
31 +     use crate::sys::unix::waker::eventfd::WakerInternal;
   |

error[E0433]: failed to resolve: use of undeclared type `WakerInternal`
  --> /home/javoerro/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.10/src/sys/unix/waker.rs:43:25
   |
43 |             let waker = WakerInternal::new()?;
   |                         ^^^^^^^^^^^^^ use of undeclared type `WakerInternal`
   |
help: consider importing this struct
   |
31 +     use crate::sys::unix::waker::eventfd::WakerInternal;
   |

Some errors have detailed explanations: E0412, E0432, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `mio` (lib) due to 3 previous errors
@Thomasdezeeuw
Copy link
Collaborator

@jasta could you help here, seeing as you wrote the ESP-IDF implementation?

@javoerro
Copy link
Author

javoerro commented Jan 4, 2024

I would like to add more information, i am using esp-idf-template for generating the project. thus, cargo is invoked by cmake to build the component.

the Cargo.toml is:

[package]
name = "rust-esp-async-nats"
version = "0.1.0"
authors = ["javoerro"]
edition = "2021"
resolver = "2"
rust-version = "1.71"

[lib]
crate-type = ["staticlib"]

[profile.release]
opt-level = "s"

[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"
[features]
default = ["std", "embassy", "esp-idf-svc/native"]

pio = ["esp-idf-svc/pio"]
std = ["alloc", "esp-idf-svc/std"]
alloc = ["esp-idf-svc/alloc"]
nightly = ["esp-idf-svc/nightly"]
experimental = ["esp-idf-svc/experimental"]
embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"]

[dependencies]
log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.47.1", default-features = false }
tokio = { version = "1.35.1", features = ["rt"] }
futures = "0.3.30"
async-nats = "0.33.0"
bytes = "1.5.0"
anyhow = "1"


[build-dependencies]
embuild = { version = "0.31.4", features = ["elf"] }

@javoerro
Copy link
Author

javoerro commented Jan 13, 2024

after several checks i found issues in the configuration of CMakeLists.txt in my project because i was using esp-idf version < 5.x causing a compilation without rustflags.
mio_unsupported_force_poll_poll works perfectly for mio in espidf target, sorry for the inconvenience!

@lorenzo-pirchio
Copy link

Hello,
I have the same problem as @javoerro writing a project in rust for esp32 while compiling xmpp.
Can anyone help me to fix that? Which parts in CMakeLists.txt do I have to change?
Thanks

@Thomasdezeeuw
Copy link
Collaborator

@lorenzo-pirchio after #1789 no extra flags will be needed, but until that makes it to a release you'll need to set RUSTFLAGS='--cfg mio_unsupported_force_poll_poll'.

@lorenzo-pirchio
Copy link

lorenzo-pirchio commented May 29, 2024

@Thomasdezeeuw Should I add this line in my Espressif folder or my project folder?
Since I changed the Cargo target directory to another folder, because I had problems with Windows, which folder should I consider?
I found different CMakeList.txt in the project.
Could you tell me which one precisely should I add the line you wrote to?
I'm sorry for asking so many questions, but I just started working on both rust and esp32.
Thanks

@Thomasdezeeuw
Copy link
Collaborator

@lorenzo-pirchio I don't develop for ESP myself, so I can't tell you exactly where to add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants