Skip to content

Can't compile with IPv4 disabled #629

Description

@DerEnderKeks

Bug description

When compiling with IPv4 disabled (CONFIG_LWIP_IPV4=n), it fails:

cargo build output
   Compiling esp-idf-svc v0.51.0
error[E0422]: cannot find struct, variant or union type `ip_addr__bindgen_ty_1` in this scope                                                                                                                                                                                                                      
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\ping.rs:108:21
      |
  108 |             u_addr: ip_addr__bindgen_ty_1 {
      |                     ^^^^^^^^^^^^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:20343:1
      |
20343 | pub union _ip_addr__bindgen_ty_1 {
      | -------------------------------- similarly named union `_ip_addr__bindgen_ty_1` defined here
      |
help: the leading underscore in `_ip_addr__bindgen_ty_1` marks it as unused, consider renaming it to `ip_addr__bindgen_ty_1`
     -->   D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:20343:11
      |
20343 - pub union _ip_addr__bindgen_ty_1 {
20343 + pub union ip_addr__bindgen_ty_1 {
      |

error[E0425]: cannot find type `ip4_addr_t` in this scope                                                                                                                                                                                                                                                          
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\ping.rs:109:32
      |
  109 |                 ip4: Newtype::<ip4_addr_t>::from(ip).0,
      |                                ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
  109 -                 ip4: Newtype::<ip4_addr_t>::from(ip).0,
  109 +                 ip4: Newtype::<ip6_addr_t>::from(ip).0,
      |
help: you might be missing a type parameter
      |
   60 | impl<ip4_addr_t> EspPing {
      |     ++++++++++++

error[E0425]: cannot find type `ip4_addr_t` in this scope                                                                                                                                                                                                                                                          
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\private\net.rs:22:39
      |
   22 | impl From<ipv4::Ipv4Addr> for Newtype<ip4_addr_t> {
      |                                       ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
   22 - impl From<ipv4::Ipv4Addr> for Newtype<ip4_addr_t> {
   22 + impl From<ipv4::Ipv4Addr> for Newtype<ip6_addr_t> {
      |
help: you might be missing a type parameter
      |
   22 | impl<ip4_addr_t> From<ipv4::Ipv4Addr> for Newtype<ip4_addr_t> {
      |     ++++++++++++

error[E0422]: cannot find struct, variant or union type `ip4_addr_t` in this scope                                                                                                                                                                                                                                 
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\private\net.rs:26:17
      |
   26 |         Newtype(ip4_addr_t {
      |                 ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
   26 -         Newtype(ip4_addr_t {
   26 +         Newtype(ip6_addr_t {
      |

error[E0425]: cannot find type `ip4_addr_t` in this scope                                                                                                                                                                                                                                                          
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\private\net.rs:32:19
      |
   32 | impl From<Newtype<ip4_addr_t>> for ipv4::Ipv4Addr {
      |                   ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
   32 - impl From<Newtype<ip4_addr_t>> for ipv4::Ipv4Addr {
   32 + impl From<Newtype<ip6_addr_t>> for ipv4::Ipv4Addr {
      |
help: you might be missing a type parameter
      |
   32 | impl<ip4_addr_t> From<Newtype<ip4_addr_t>> for ipv4::Ipv4Addr {
      |     ++++++++++++

error[E0425]: cannot find type `ip4_addr_t` in this scope                                                                                                                                                                                                                                                          
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\private\net.rs:33:25
      |
   33 |     fn from(ip: Newtype<ip4_addr_t>) -> Self {
      |                         ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
   33 -     fn from(ip: Newtype<ip4_addr_t>) -> Self {
   33 +     fn from(ip: Newtype<ip6_addr_t>) -> Self {
      |
help: you might be missing a type parameter
      |
   32 | impl<ip4_addr_t> From<Newtype<ip4_addr_t>> for ipv4::Ipv4Addr {
      |     ++++++++++++

error[E0425]: cannot find type `ip4_addr_t` in this scope                                                                                                                                                                                                                                                          
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\private\net.rs:57:29
      |
   57 | impl From<Mask> for Newtype<ip4_addr_t> {
      |                             ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
   57 - impl From<Mask> for Newtype<ip4_addr_t> {
   57 + impl From<Mask> for Newtype<ip6_addr_t> {
      |
help: you might be missing a type parameter
      |
   57 | impl<ip4_addr_t> From<Mask> for Newtype<ip4_addr_t> {
      |     ++++++++++++

error[E0425]: cannot find type `ip4_addr_t` in this scope                                                                                                                                                                                                                                                          
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\private\net.rs:65:22
      |
   65 | impl TryFrom<Newtype<ip4_addr_t>> for Mask {
      |                      ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
   65 - impl TryFrom<Newtype<ip4_addr_t>> for Mask {
   65 + impl TryFrom<Newtype<ip6_addr_t>> for Mask {
      |
help: you might be missing a type parameter
      |
   65 | impl<ip4_addr_t> TryFrom<Newtype<ip4_addr_t>> for Mask {
      |     ++++++++++++

error[E0425]: cannot find type `ip4_addr_t` in this scope                                                                                                                                                                                                                                                          
     --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\private\net.rs:68:33
      |
   68 |     fn try_from(esp_ip: Newtype<ip4_addr_t>) -> Result<Self, Self::Error> {
      |                                 ^^^^^^^^^^
      |
     ::: D:\REDACTED\target\riscv32imac-esp-espidf\debug\build\esp-idf-sys-b057318a5a5cd74a\out\bindings.rs:30366:1
      |
30366 | pub type ip6_addr_t = ip6_addr;
      | ------------------- similarly named type alias `ip6_addr_t` defined here
      |
help: a type alias with a similar name exists
      |
   68 -     fn try_from(esp_ip: Newtype<ip4_addr_t>) -> Result<Self, Self::Error> {
   68 +     fn try_from(esp_ip: Newtype<ip6_addr_t>) -> Result<Self, Self::Error> {
      |
help: you might be missing a type parameter
      |
   65 | impl<ip4_addr_t> TryFrom<Newtype<ip4_addr_t>> for Mask {
      |     ++++++++++++

error[E0560]: struct `ip6_addr` has no field named `u_addr`                                                                                                                                                                                                                                                        
   --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\ping.rs:108:13
    |
108 |             u_addr: ip_addr__bindgen_ty_1 {
    |             ^^^^^^ unknown field
    |
help: a field with a similar name exists
    |
108 -             u_addr: ip_addr__bindgen_ty_1 {
108 +             addr: ip_addr__bindgen_ty_1 {
    |

error[E0560]: struct `ip6_addr` has no field named `type_`                                                                                                                                                                                                                                                         
   --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\ping.rs:111:13
    |
111 |             type_: 0,
    |             ^^^^^ `ip6_addr` does not have this field
    |
    = note: available fields are: `addr`, `zone`

error[E0609]: no field `u_addr` on type `&mut ip6_addr`                                                                                                                                                                                                                                                            
   --> C:\Users\REDACTED\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\esp-idf-svc-0.51.0\src\ping.rs:225:53
    |
225 |         let addr = ipv4::Ipv4Addr::from(target_addr.u_addr.ip4.addr);
    |                                                     ^^^^^^ unknown field
    |
help: a field with a similar name exists
    |
225 -         let addr = ipv4::Ipv4Addr::from(target_addr.u_addr.ip4.addr);
225 +         let addr = ipv4::Ipv4Addr::from(target_addr.addr.ip4.addr);
    |

Some errors have detailed explanations: E0422, E0425, E0560, E0609.                                                                                                                                                                                                                                                
For more information about an error, try `rustc --explain E0422`.
error: could not compile `esp-idf-svc` (lib) due to 12 previous errors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  • Would you like to work on a fix? n

To Reproduce

  1. Create a new project using cargo generate esp-rs/esp-idf-template cargo
  2. In sdkconfig.defaults, set CONFIG_LWIP_IPV4=n and CONFIG_LWIP_IPV6=y
  3. cargo build

Expected behavior

I expected it to compile, with IPv4 successfully disabled. According to the docs, this should be possible.

Environment

  • Crate (esp-idf-svc) version: 0.51 & master (71bb200)
  • ESP-IDF branch or tag: v5.3.3
  • Target device (MCU): esp32c6
  • OS: Windows 11

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status
      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions