rust3ds / cargo-3ds

Cargo command to work with Nintendo 3DS project binaries.
Apache License 2.0
59 stars 10 forks source link

[Help/Feature Request]: Support for winit and rustix #53

Closed lexi-the-cute closed 8 months ago

lexi-the-cute commented 8 months ago

I'm trying to build my game engine to work on a 3DS and noticed that it fails to compile because of an indirect dependency on rustix. I sent a report to both https://github.com/rust-windowing/winit/issues/3522 and https://github.com/bytecodealliance/rustix/issues/1023

I've already successfully tested against a project that uses ctru, so the environment itself is setup correctly. It just doesn't work for winit right now

compile-log.txt

Meziu commented 8 months ago

The 3DS software stack doesn't support POSIX calls (since the OS is fundamentally different) except a couple that have been reimplemented or wrapped by the devkitARM toolchain. Furthermore, in HorizonOS (the 3DS's operating system) there is no windowing system that winit might even try to leverage, as those are fundamentally specific approaches made for common Linux/Windows/Mac platforms. Unless someone were to manually develop wraps and layers to support those libraries (something I personally believe to be impossible) there is no way those crates are ever going to compile in a functional state.

This is something we mention in the ctru-rs wiki:

Even while using ctru-rs, modules such as std::process and std::thread (plus most third party crates) may not work (or work differently than originally intended) because of how the OS operates. You can read more about that in System Flaws.

Please, do not expect such complex architecture to just work out-of-the-box with our or devkitARM's toolchain. This is something outside of our (or even the console's hardware) capabilities.

I suggest you close the issues opened in those third-party crates.

Edit: as a note, the only thing I can suggest you to do is to disable those dependencies in armv6k-nintendo-3ds builds and rather re-implement the used functionality using libraries closer to the hardware and software stack, like ctru-sys and ctru-rs. It's a whole lot of work, but that's just how things are when working for these hyper-specific platforms.

lexi-the-cute commented 8 months ago

The winit people said they played around with the idea before, but are not looking at it as a high priority issue. They did mention how they were considering to implement it, so if I ever get the knowledge on how to implement a wrapper for this, I can look at implementing it in the future. In the meantime, I can play around with seeing if I can load it on Linux on the 3DS