quinn: Fails to build on FreeBSD

Regressed by b681c654124d (usize) and 1bc75aa01486 (in_pktinfo)

$ pkg install rust
$ rustc -vV
rustc 1.52.1
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-freebsd
release: 1.52.1
LLVM version: 12.0.0

$ cargo build
[...]
error[E0422]: cannot find struct, variant or union type `in_pktinfo` in crate `libc`
   --> quinn/src/platform/unix.rs:387:41
    |
387 |                       let pktinfo = libc::in_pktinfo {
    |                                           ^^^^^^^^^^ help: a struct with a similar name exists: `in6_pktinfo`
    |
   ::: ../libc-0.2.97/src/unix/bsd/freebsdlike/mod.rs:82:1
    |
82  | / s! {
83  | |     pub struct in_addr {
84  | |         pub s_addr: ::in_addr_t,
85  | |     }
...   |
346 | |     }
347 | | }
    | |_- similarly named struct `in6_pktinfo` defined here

error[E0425]: cannot find value `IP_PKTINFO` in crate `libc`
   --> quinn/src/platform/unix.rs:394:58
    |
394 |                     encoder.push(libc::IPPROTO_IP, libc::IP_PKTINFO, pktinfo);
    |                                                          ^^^^^^^^^^ help: a constant with a similar name exists: `IPV6_PKTINFO`
    |
   ::: ../libc-0.2.97/src/unix/bsd/freebsdlike/mod.rs:919:1
    |
919 | pub const IPV6_PKTINFO: ::c_int = 46;
    | ------------------------------------- similarly named constant `IPV6_PKTINFO` defined here

error[E0531]: cannot find unit struct, unit variant or constant `IP_PKTINFO` in crate `libc`
   --> quinn/src/platform/unix.rs:454:38
    |
454 |             (libc::IPPROTO_IP, libc::IP_PKTINFO) => unsafe {
    |                                      ^^^^^^^^^^ help: a constant with a similar name exists: `IPV6_PKTINFO`
    |
   ::: ../libc-0.2.97/src/unix/bsd/freebsdlike/mod.rs:919:1
    |
919 | pub const IPV6_PKTINFO: ::c_int = 46;
    | ------------------------------------- similarly named constant `IPV6_PKTINFO` defined here

error[E0412]: cannot find type `in_pktinfo` in crate `libc`
   --> quinn/src/platform/unix.rs:455:52
    |
455 |                   let pktinfo = cmsg::decode::<libc::in_pktinfo>(cmsg);
    |                                                      ^^^^^^^^^^ help: a struct with a similar name exists: `in6_pktinfo`
    |
   ::: ../libc-0.2.97/src/unix/bsd/freebsdlike/mod.rs:82:1
    |
82  | / s! {
83  | |     pub struct in_addr {
84  | |         pub s_addr: ::in_addr_t,
85  | |     }
...   |
346 | |     }
347 | | }
    | |_- similarly named struct `in6_pktinfo` defined here

error[E0308]: mismatched types
   --> quinn/src/platform/unix.rs:287:17
    |
287 |                 bufs.len().min(BATCH_SIZE) as libc::c_uint,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32`
    |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
    |
287 |                 (bufs.len().min(BATCH_SIZE) as libc::c_uint).try_into().unwrap(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0308, E0412, E0422, E0425, E0531.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `quinn`

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I’d be willing to put some work into this; we (the veloren project) use quinn and quinn-udp for our game fixing this issue would not only make the game one step closer to running on freebsd but also help a whole lot of other people