You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to get tokio console working, but after dealing with the missing getrandom support, I found that there's a bunch of libc items not present which are required by mio and socket2. These two crates are compiled because there's a crate in the tree which requires tokio's io-util feature. The exact path is console-subscriber -> tonic -> h2 -> tokio -> mio and socket2. These errors would show up if anyone wanted to use tokio's io-util feature, so it's not just limited to tokio console.
One of the errors from mio is related to missing pipe support, which we may not be able to work around without submitting a PR to that repo. But it still gives some interesting error messages which we can use to improve our libc support.
Errors I saw with `cargo 3ds build --example futures-tokio` (after adding tokio console support)
RunningCargoUpdating crates.io index
Compiling log v0.4.14Compiling futures-core v0.3.21Compiling futures-channel v0.3.21Compiling indexmap v1.8.0Compiling httparse v1.6.0Compiling miniz_oxide v0.4.4Compiling crc32fast v1.3.2Compiling serde v1.0.136Compiling crossbeam-utils v0.8.7Compiling num-traits v0.2.14Compiling serde_json v1.0.79Compiling nom v7.1.0Compiling bytes v1.1.0Compiling lazy_static v1.4.0Compiling futures-sink v0.3.21Compiling itoa v1.0.1Compiling hashbrown v0.11.2Compiling fnv v1.0.7Compiling ppv-lite86 v0.2.16Compiling try-lock v0.2.3Compiling tower-service v0.3.1Compiling pin-project v1.0.10Compiling httpdate v1.0.2Compiling base64 v0.13.0Compiling adler v1.0.2Compiling tower-layer v0.3.1Compiling percent-encoding v2.1.0Compiling once_cell v1.9.0Compiling minimal-lexical v0.2.1Compiling ryu v1.0.9Compiling byteorder v1.4.3Compiling ctru-rs v0.7.1(/home/mark/media/Projects/3DS/ctru-rs/ctru-rs)Compiling humantime v2.1.0Compiling socket2 v0.4.4Compiling getrandom v0.2.4(/home/mark/media/Projects/3DS/getrandom)Compiling console-api v0.1.2error[E0432]: unresolved import `libc::SOCK_RAW`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:64:16
|
64 | pub(crate)use libc::SOCK_RAW;
| ^^^^^^^^^^^^^^ no `SOCK_RAW` in the root
error[E0432]: unresolved import `libc::SOCK_SEQPACKET`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:66:16
|
66 | pub(crate)use libc::SOCK_SEQPACKET;
| ^^^^^^^^^^^^^^^^^^^^ no `SOCK_SEQPACKET` in the root
error[E0432]: unresolved import `libc::MSG_TRUNC`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:76:23
|
76 | pub(crate)uselibc::{MSG_TRUNC,SO_OOBINLINE};
| ^^^^^^^^^
| |
| no `MSG_TRUNC` in the root
| help: a similar name exists in the module: `O_TRUNC`
error[E0432]: unresolved import `libc::IP_HDRINCL`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:79:16
|
79 | pub(crate)use libc::IP_HDRINCL;
| ^^^^^^^^^^^^^^^^ no `IP_HDRINCL` in the root
Compiling tracing-core v0.1.22Compiling sharded-slab v0.1.4error[E0433]: failed to resolve:use of undeclared type `IovLen`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:769:38
|
769 | msg.msg_iovlen = min(bufs.len(),IovLen::MAXasusize)asIovLen;
| ^^^^^^ use of undeclared type `IovLen`
error[E0433]: failed to resolve:use of undeclared type `IovLen`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:829:38
|
829 | msg.msg_iovlen = min(bufs.len(),IovLen::MAXasusize)asIovLen;
| ^^^^^^ use of undeclared type `IovLen`
error[E0531]: cannot find unit struct, unit variant or constant `SOCK_RAW` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:341:11
|
341 | libc::SOCK_RAW,
| ^^^^^^^^ not found in `libc`
error[E0531]:cannot find unit struct, unit variant or constant `SOCK_RDM` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:343:11
|
343 | libc::SOCK_RDM,
| ^^^^^^^^ not found in `libc`
error[E0531]:cannot find unit struct, unit variant or constant `SOCK_SEQPACKET` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:344:11
|
344 | libc::SOCK_SEQPACKET,
| ^^^^^^^^^^^^^^ not found in `libc`
error[E0425]:cannot find value `MSG_EOR` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:388:24
|
388 | self.0& libc::MSG_EOR != 0
| ^^^^^^^ help: a constant with a similar name exists: `MSG_MORE`
|
::: /home/mark/.cargo/git/checkouts/libc-445906a8a7176182/389e566/src/unix/newlib/horizon/mod.rs:116:1
|
116 | pub const MSG_MORE:::c_int = 0;
| -------------------------------- similarly named constant `MSG_MORE` defined here
error[E0412]: cannot find type `msghdr` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:765:24
|
765 | let mut msg: libc::msghdr = unsafe{ mem::zeroed()};
| ^^^^^^ not found in `libc`
error[E0412]: cannot find type `IovLen` in this scope
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:769:63
|
769 | msg.msg_iovlen = min(bufs.len(),IovLen::MAXasusize)asIovLen;
| ^^^^^^ not found in this scope
error[E0425]: cannot find function `recvmsg` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:770:14
|
770 | syscall!(recvmsg(fd,&mut msg, flags))
| ^^^^^^^ not found in `libc`
error[E0412]: cannot find type `msghdr` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:821:24
|
821 | let mut msg: libc::msghdr = unsafe{ mem::zeroed()};
| ^^^^^^ not found in `libc`
error[E0412]: cannot find type `IovLen` in this scope
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:829:63
|
829 | msg.msg_iovlen = min(bufs.len(),IovLen::MAXasusize)asIovLen;
| ^^^^^^ not found in this scope
error[E0425]: cannot find function `sendmsg` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:830:14
|
830 | syscall!(sendmsg(fd,&msg, flags)).map(|n| n asusize)
| ^^^^^^^ not found in `libc`
error[E0412]: cannot find type `ip_mreqn` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:1013:12
|
1013 | ) -> libc::ip_mreqn{
| ^^^^^^^^ help: a struct with a similar name exists: `ip_mreq`
|
::: /home/mark/.cargo/git/checkouts/libc-445906a8a7176182/389e566/src/unix/newlib/mod.rs:41:1
|
41 | / s!{42 | | // The order of the `ai_addr` field in this struct is crucial43 | | // for converting between the Rust and C types.44 | | pubstruct addrinfo {
... |
219 | | }220 | | }
| |_- similarly named struct `ip_mreq` defined here
error[E0422]: cannot find struct, variant or uniontype `ip_mreqn` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:1015:75
|
1015 | crate::socket::InterfaceIndexOrAddress::Index(interface) => libc::ip_mreqn{
| ^^^^^^^^ help: a struct with a similar name exists: `ip_mreq`
|
::: /home/mark/.cargo/git/checkouts/libc-445906a8a7176182/389e566/src/unix/newlib/mod.rs:41:1
|
41 | / s!{42 | | // The order of the `ai_addr` field in this struct is crucial43 | | // for converting between the Rust and C types.44 | | pubstruct addrinfo {
... |
219 | | }220 | | }
| |_- similarly named struct `ip_mreq` defined here
error[E0422]: cannot find struct, variant or uniontype `ip_mreqn` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/sys/unix.rs:1020:77
|
1020 | crate::socket::InterfaceIndexOrAddress::Address(interface) => libc::ip_mreqn{
| ^^^^^^^^ help: a struct with a similar name exists: `ip_mreq`
|
::: /home/mark/.cargo/git/checkouts/libc-445906a8a7176182/389e566/src/unix/newlib/mod.rs:41:1
|
41 | / s!{42 | | // The order of the `ai_addr` field in this struct is crucial43 | | // for converting between the Rust and C types.44 | | pubstruct addrinfo {
... |
219 | | }220 | | }
| |_- similarly named struct `ip_mreq` defined here
Compiling async-stream v0.3.2Compiling mio v0.8.0Compiling want v0.3.0Compiling thread_local v1.1.4
error: unsupported target for `mio::unix::pipe`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/sys/unix/pipe.rs:197:5
|
197 | compile_error!("unsupported target for `mio::unix::pipe`");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0432]: unresolved imports `self::selector::event`, `self::selector::Event`, `self::selector::Events`, `self::selector::Selector`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/sys/unix/mod.rs:18:37
|
18 | pub(crate)useself::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`
error[E0432]: unresolved import `self::waker::Waker`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/sys/unix/mod.rs:24:20
|
24 | pub(crate)useself::waker::Waker;
| ^^^^^^^^^^^^^^^^^^ no `Waker` in `sys::unix::waker`
error[E0425]: cannot find value `stream` in this scope
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/sys/unix/tcp.rs:112:58
|
112 | unsafe{to_socket_addr(addr.as_ptr())}.map(|addr| (stream, addr))
| ^^^^^^ not found in this scope
error[E0425]: cannot find value `SOCK_NONBLOCK` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/sys/unix/uds/listener.rs:53:27
|
53 | let flags = libc::SOCK_NONBLOCK | libc::SOCK_CLOEXEC;
| ^^^^^^^^^^^^^ help: a constant with a similar name exists: `O_NONBLOCK`
|
::: /home/mark/.cargo/git/checkouts/libc-445906a8a7176182/389e566/src/unix/newlib/mod.rs:436:1
|
436 | pub const O_NONBLOCK:::c_int = 16384;
| -------------------------------------- similarly named constant `O_NONBLOCK` defined here
error[E0425]: cannot find function `accept4` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/sys/unix/uds/listener.rs:54:18
|
54 | syscall!(accept4(
| ^^^^^^^ help: a function with a similar name exists: `accept`
|
::: /home/mark/.cargo/git/checkouts/libc-445906a8a7176182/389e566/src/unix/mod.rs:618:5
|
618 | pubfn accept(socket:::c_int, address:*mut sockaddr, address_len:*mut socklen_t) -> ::c_int;
| ----------------------------------------------------------------------------------------------- similarly named function `accept` defined here
error[E0425]: cannot find value `SOCK_NONBLOCK` incrate `libc`
--> /home/mark/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.0/src/sys/unix/uds/mod.rs:81:35
|
81 | let flags = flags | libc::SOCK_NONBLOCK | libc::SOCK_CLOEXEC;
| ^^^^^^^^^^^^^ help: a constant with a similar name exists: `O_NONBLOCK`
|
::: /home/mark/.cargo/git/checkouts/libc-445906a8a7176182/389e566/src/unix/newlib/mod.rs:436:1
|
436 | pubconstO_NONBLOCK:::c_int = 16384;
| -------------------------------------- similarly named constant `O_NONBLOCK` defined here
Compiling rand_core v0.6.3Some errors have detailed explanations:E0412,E0422,E0425,E0432,E0433,E0531.For more information about an error, try `rustc --explain E0412`.
error: could not compile `socket2` due to 19 previous errors
warning: build failed, waiting for other jobs to finish...
Some errors have detailed explanations:E0425,E0432.For more information about an error, try `rustc --explain E0425`.
error: build failed
Do these crates support Newlib/ a generic UNIX or do they only plan on supporting Linux? Making a full GNU Linux libc implementation is way out of scope. Ok having support, but those systems are way to different (some may even require /dev/ paths or processes). We should be careful with what we want to support.
Neither library has an explicit newlib section, so more investigation is needed to check if it's feasible to implement support. I think the only concerns would be in mio since it requires OS support for async io.
Edit: see for example ivmarkov/rust-esp32-std-demo#9
Opened an issue here since https://github.com/Meziu/libc doesn't have issues enabled.
I was trying to get tokio console working, but after dealing with the missing
getrandom
support, I found that there's a bunch of libc items not present which are required by mio and socket2. These two crates are compiled because there's a crate in the tree which requires tokio'sio-util
feature. The exact path isconsole-subscriber
->tonic
->h2
->tokio
->mio
andsocket2
. These errors would show up if anyone wanted to use tokio'sio-util
feature, so it's not just limited to tokio console.One of the errors from mio is related to missing pipe support, which we may not be able to work around without submitting a PR to that repo. But it still gives some interesting error messages which we can use to improve our libc support.
Errors I saw with `cargo 3ds build --example futures-tokio` (after adding tokio console support)
cc: @Meziu @ian-h-chamberlain
The text was updated successfully, but these errors were encountered: