quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.85k stars 394 forks source link

libc.in_pktinfo doesn't exist on FreeBSD #1373

Closed yurivict closed 2 years ago

yurivict commented 2 years ago

The Solana project version 1.10.12 build failure:

error[E0422]: cannot find struct, variant or union type `in_pktinfo` in crate `libc`
   --> /wrkdirs/usr/ports/security/solana/work/solana-1.10.12/cargo-crates/quinn-udp-0.1.1/src/unix.rs:438:41
    |
438 |                       let pktinfo = libc::in_pktinfo {
    |                                           ^^^^^^^^^^ help: a struct with a similar name exists: `in6_pktinfo`
    |
   ::: /wrkdirs/usr/ports/security/solana/work/solana-1.10.12/cargo-crates/libc-0.2.124/src/unix/bsd/freebsdlike/mod.rs:83:1
    |
83  | / s! {
84  | |     pub struct in_addr {
85  | |         pub s_addr: ::in_addr_t,
86  | |     }
...   |
374 | |     }
375 | | }
    | |_- similarly named struct `in6_pktinfo` defined here

error[E0425]: cannot find value `IP_PKTINFO` in crate `libc`
   --> /wrkdirs/usr/ports/security/solana/work/solana-1.10.12/cargo-crates/quinn-udp-0.1.1/src/unix.rs:445:58
    |
445 |                     encoder.push(libc::IPPROTO_IP, libc::IP_PKTINFO, pktinfo);
    |                                                          ^^^^^^^^^^ help: a constant with a similar name exists: `IPV6_PKTINFO`
    |
   ::: /wrkdirs/usr/ports/security/solana/work/solana-1.10.12/cargo-crates/libc-0.2.124/src/unix/bsd/freebsdlike/mod.rs:968:1
    |
968 | 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`
   --> /wrkdirs/usr/ports/security/solana/work/solana-1.10.12/cargo-crates/quinn-udp-0.1.1/src/unix.rs:505:38
    |
505 |             (libc::IPPROTO_IP, libc::IP_PKTINFO) => unsafe {
    |                                      ^^^^^^^^^^ help: a constant with a similar name exists: `IPV6_PKTINFO`
    |
   ::: /wrkdirs/usr/ports/security/solana/work/solana-1.10.12/cargo-crates/libc-0.2.124/src/unix/bsd/freebsdlike/mod.rs:968:1

See also the comments here: https://github.com/rust-lang/libc/issues/2781#issuecomment-1159615107

rust-1.60.0 OS: FreeBSD 13

Ralith commented 2 years ago

Dup of https://github.com/quinn-rs/quinn/issues/1142.