Rustc allowes to cross compile to a different target with rustc example.rs --target=aarch64-unknown-linux-gnu. But the programm cannot use the std. To use the std the rustc has to be compiled with ./configure --target=platforms,you,want.
So i am thinking if it would be possible to put std on crates.io. Then if someone wants to cross compile, cargo could download and compile std like any other library.
Publishing std to crates.io is much complicated by std’s symbiotic relationship to rustc - it relies on a lot of unstable and version-specific compiler features to operate.
I want to make cross-compiling with Rust easy, but think the solution needs to be more comprehensive than just publishing std somewhere cargo can find it.
My personal ambition is to create a service that builds Rust cross-compile toolchains in every configuration, provides easy installation, and even VM’s on which to run them. I think this can be done as an extension of the Rust compiler’s existing distribution mechanism.
@brson All those things you mention would be generally useful for any set of packages not just {std, rustc}. I.e. while Mozilla probably doesn’t want to build peoples’ packages for them, no point writing infrastructure that isn’t reusable.
Also simply relying on prebuilt libstds will not help people defining their own targets.
Building libstd with cargo and treating at as a package dependency will stress Cargo in important ways and result in a simpler ecosystem.
Publishing std to crates.io is much complicated by std's symbiotic
relationship to rustc - it relies on a lot of unstable and
version-specific compiler features to operate.
Well this could be avoided by putting a std version to creates.io for each rustc release. This way the cargo would download automatically the right version of std. I mean it is possible to specify a exact version in the Cargo.lock file.
Yeah I’d hope that initially cargo can pretend std (and crates behind the facade) are packages for the sake of cross compiling, and later they can actually become real packages.