Young developer looking to make new programming experiences ๐.
Italy โค๏ธ๐ฎ๐น.
Stats generated thanks to github-stats
. โญ
This project forked from rust-lang/rust
Empowering everyone to build reliable and efficient software.
Home Page: https://www.rust-lang.org
License: Other
Young developer looking to make new programming experiences ๐.
Italy โค๏ธ๐ฎ๐น.
Stats generated thanks to github-stats
. โญ
This is falling out from the discussion in rust3ds/pthread-3ds#13
Based on rust-lang#91659 โย many targets default to false
for has_thread_local
, including armv6k-nintendo-3ds
. Based on our testing #[thread_local]
does work on this platform, and as someone pointed out it appears all ARM targets actually support the #[thread_local]
attribute.
I think we should add has_thread_local: true
to take advantage of the "fast" thread-local support builtin to std
: https://github.com/Meziu/rust-horizon/blob/horizon-std/library/std/src/thread/mod.rs#L186
I can do it (trivial change) but I wanted to make sure everyone's on board before submitting a PR to update the target. I'm building a local version of the compiler to test as well.
I was testing path
and fs
for #6.
Turns out, reading files is broken: doing so will result in a failed memory allocation. Looking into it it seems an issue with fstat
, since it returns a wrong st_size
value (always 1644524307), which the Rust File
will then try to allocate into a Vec
. That'd be about 1.67 GB of memory, so the system just dies.
From testing the network example, i noticed that panic!, unwraps and anything that calls a panic in the Rust runtime crashes the program as a translation - error
data abort
in Luma3DS. This is unintended behaviour, and my previous work on the std should have fixed it. It came back only now, possibly because of changes in the std
code. @AzureMarker, if you want to help, this is pretty much the priority right now.
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'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.
Running Cargo
Updating crates.io index
Compiling log v0.4.14
Compiling futures-core v0.3.21
Compiling futures-channel v0.3.21
Compiling indexmap v1.8.0
Compiling httparse v1.6.0
Compiling miniz_oxide v0.4.4
Compiling crc32fast v1.3.2
Compiling serde v1.0.136
Compiling crossbeam-utils v0.8.7
Compiling num-traits v0.2.14
Compiling serde_json v1.0.79
Compiling nom v7.1.0
Compiling bytes v1.1.0
Compiling lazy_static v1.4.0
Compiling futures-sink v0.3.21
Compiling itoa v1.0.1
Compiling hashbrown v0.11.2
Compiling fnv v1.0.7
Compiling ppv-lite86 v0.2.16
Compiling try-lock v0.2.3
Compiling tower-service v0.3.1
Compiling pin-project v1.0.10
Compiling httpdate v1.0.2
Compiling base64 v0.13.0
Compiling adler v1.0.2
Compiling tower-layer v0.3.1
Compiling percent-encoding v2.1.0
Compiling once_cell v1.9.0
Compiling minimal-lexical v0.2.1
Compiling ryu v1.0.9
Compiling byteorder v1.4.3
Compiling ctru-rs v0.7.1 (/home/mark/media/Projects/3DS/ctru-rs/ctru-rs)
Compiling humantime v2.1.0
Compiling socket2 v0.4.4
Compiling getrandom v0.2.4 (/home/mark/media/Projects/3DS/getrandom)
Compiling console-api v0.1.2
error[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) use libc::{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.22
Compiling sharded-slab v0.1.4
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:769:38
|
769 | msg.msg_iovlen = min(bufs.len(), IovLen::MAX as usize) as IovLen;
| ^^^^^^ 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::MAX as usize) as IovLen;
| ^^^^^^ use of undeclared type `IovLen`
error[E0531]: cannot find unit struct, unit variant or constant `SOCK_RAW` in crate `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` in crate `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` in crate `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` in crate `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` in crate `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::MAX as usize) as IovLen;
| ^^^^^^ not found in this scope
error[E0425]: cannot find function `recvmsg` in crate `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` in crate `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::MAX as usize) as IovLen;
| ^^^^^^ not found in this scope
error[E0425]: cannot find function `sendmsg` in crate `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 as usize)
| ^^^^^^^ not found in `libc`
error[E0412]: cannot find type `ip_mreqn` in crate `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 crucial
43 | | // for converting between the Rust and C types.
44 | | pub struct addrinfo {
... |
219 | | }
220 | | }
| |_- similarly named struct `ip_mreq` defined here
error[E0422]: cannot find struct, variant or union type `ip_mreqn` in crate `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 crucial
43 | | // for converting between the Rust and C types.
44 | | pub struct addrinfo {
... |
219 | | }
220 | | }
| |_- similarly named struct `ip_mreq` defined here
error[E0422]: cannot find struct, variant or union type `ip_mreqn` in crate `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 crucial
43 | | // for converting between the Rust and C types.
44 | | pub struct addrinfo {
... |
219 | | }
220 | | }
| |_- similarly named struct `ip_mreq` defined here
Compiling async-stream v0.3.2
Compiling mio v0.8.0
Compiling want v0.3.0
Compiling 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) 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`
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) use self::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` in crate `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` in crate `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 | pub fn 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` in crate `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 | pub const O_NONBLOCK: ::c_int = 16384;
| -------------------------------------- similarly named constant `O_NONBLOCK` defined here
Compiling rand_core v0.6.3
Some 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
Broke this out of #11 since I think it's a separate issue from reading the files themselves, but we need to figure out some way to handle the weirdness of using paths like smdc:/
, romfs:/
.
Edit: I think we might also need to reconsider the path scheme (or add OS-specific helpers), since I have noticed some weird behavior with .parent()
and .pop()
.... and the romfs:/
seems a bit nonstandard for unix-like OSes.
Edit: seems like RedoxOS already uses a similar scheme (and has some support in sys::path
), so maybe we can piggyback off of that: https://doc.redox-os.org/book/ch04-06-schemes.html
Originally posted by @ian-h-chamberlain in #11 (comment)
We have worked with most of the std
while updating ctru-rs
's modules. However, we now have to merge our changes into the rustlang tree, and this will require cleanup and a lot of testing. We must make sure to never have to make PR's to std
ever again, since the effort for the contributor and the reviewer is great.
Since very basic/already tested multiple times, I'd skip testing of fundamental datatypes and of these modules:
TESTED AND NOW WORKING MODULES:
Modules we should test, though we have already worked with:
Other than testing, cleaning up lints and other problems is needed.
@AzureMarker @ian-h-chamberlain
Please, a combined effort is the best and fastest way.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.