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

ESP-IDF compiation error #508

Open
nandra opened this issue Apr 25, 2024 · 4 comments
Open

ESP-IDF compiation error #508

nandra opened this issue Apr 25, 2024 · 4 comments

Comments

@nandra
Copy link

nandra commented Apr 25, 2024

Hi,

I'm facing an issue with building socket2 on esp platform. I found issue #379 which seems to have fix. But seems I'm hitting some other problem:

error[E0432]: unresolved import `libc::IP_HDRINCL`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.10/src/sys/unix.rs:83:16
   |
83 | pub(crate) use libc::IP_HDRINCL;
   |                ^^^^^^^^^^^^^^^^ no `IP_HDRINCL` in the root

error[E0432]: unresolved imports `self::selector::event`, `self::selector::Event`, `self::selector::Events`, `self::selector::Selector`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.11/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`

I've tried 0.4.10 and also 0.5.6 issue is the same. Any ideas please? Thanks.

@Thomasdezeeuw
Copy link
Collaborator

The first problem should have already been solved by #460. Can you try v0.5.6? (I know your comments mentions trying it, but the error is from v0.4.10)

Also the second error is in Mio, which is a different library: https://github.com/tokio-rs/mio, you might want to look at tokio-rs/mio#1703.

@nandra
Copy link
Author

nandra commented Apr 25, 2024

@Thomasdezeeuw thanks for pointig me out to commit. I'm trying 0.5.6 by adding :

socket2 = { version = "0.5.6", features = ["all"] }

to dependencies but during build I'm still seeing:

error: could not compile `socket2` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0432]: unresolved import `libc::IP_HDRINCL`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.10/src/sys/unix.rs:83:16
   |
83 | pub(crate) use libc::IP_HDRINCL;
   |                ^^^^^^^^^^^^^^^^ no `IP_HDRINCL` in the root

error: aborting due to previous error

and it seems ti compile both versions of socket2:

   Compiling socket2 v0.4.10
   Compiling socket2 v0.5.6

Sorry for dummy responses I just started with rust ;). Thanks.

@Thomasdezeeuw
Copy link
Collaborator

Thomasdezeeuw commented Apr 26, 2024

@Thomasdezeeuw thanks for pointig me out to commit. I'm trying 0.5.6 by adding :

socket2 = { version = "0.5.6", features = ["all"] }

to dependencies but during build I'm still seeing:

I'm afraid that doesn't work. One of your dependencies is still using v0.4 and since updating to v0.5 could contain breaking changes (which is does for socket2), Cargo will not force your dependencies to use v0.5.

You can list all your dependencies and their dependencies using cargo tree. There you can see what is still using socket2 v0.4.

However, since socket2 v0.4 is still supported we should also fix it. Except, I don't have any build setup for ESP-IDF, nor do we have CI setup. Would you be willing to give it a shot?

If you are, I think it's checking out the v0.4 branch and updating https://github.com/rust-lang/socket2/blob/v0.4.x/src/sys/unix.rs#L82-L83 to look like

socket2/src/sys/unix.rs

Lines 135 to 136 in 6923954

#[cfg(all(feature = "all", not(any(target_os = "redox", target_os = "espidf"))))]
pub(crate) use libc::IP_HDRINCL;
(same file on the main/v0.5 branch).

@Thomasdezeeuw
Copy link
Collaborator

I think backporting 77e3bb9 should fix 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

2 participants