5 ms·
It's not mentioned in the post, but 1.8 also includes support for installing additional versions of the stdlib for other targets using rustup/multirust[1], whic
by Perceptes 11y ago
It's not mentioned in the post, but 1.8 also includes support for installing additional versions of the stdlib for other targets using rustup/multirust[1], which is huge for cross compilation:
$ rustup target add x86_64-unknown-linux-musl
info: downloading component 'rust-std' for 'x86_64-unknown-linux-musl'
13.77 MiB / 13.77 MiB (100.00%) 1.47 MiB/s ETA: 0s
info: installing component 'rust-std' for 'x86_64-unknown-linux-musl'
Which allows:
$ cargo build --target x86_64-unknown-linux-musl
You can get a list of available targets with `rustc --print target-list`.
[1] https://www.rustup.rs/ https://www.rustup.rs/
- steveklabnik 11y agoYeah, I didn't mention it in the post because rustup is still in beta. Once it's officially ready to go, trust me, I will start talking about it a lot :)
- 6d65 11y agoI wonder if in the long run it will be possible to generate an Android APK without having the Android NDK/SDK installed. Since it could link against the Android's stdlib. Though, I guess Android NDK uses a custom toolchain, linker, so it might not be that easily achieveable. Though it will give Rust an advantage over other newcomers. Crosscompilation for multiple OS'es/Architecture seems like a big selling point.
- steveklabnik 11y agohttps://users.rust-lang.org/t/psa-rustc-cargo-can-now-be-installed-on-arm-linux-netbsd-and-freebsd-using-rustup-multirust/5383/7?u=steveklabnik https://users.rust-lang.org/t/psa-rustc-cargo-can-now-be-ins...
- 6d65 11y agoYep. That's exactly what I was thinking about. Rust just keeps getting better and better.
- simcop2387 11y agoThis is definitely going to be big for enabling cross compiling. I've been fighting to get things working sanely. Is there any info on how one would build a new stdlib/corelib for a target? I'm actually anxious to see how much it might help to be able to use Rust on small ARM processors.
- steveklabnik 11y agoWe don't have great docs on it yet. https://github.com/japaric/rust-cross https://github.com/japaric/rust-cross is some info. Once we have stuff all in place exactly as we want it, I will be working on good docs to make it much easier for people, but it's still a bit wild-west at the moment.
- simcop2387 11y agoGood to know that docs will be forthcoming. that link is where i've been working from, and it will usually work but sometimes when i'm upgrading rust it'll just magically not work and i've never figured out why, hence the wild west as you put it. It's definitely looking more and more awesome to be able to get that stuff working.
- hsivonen 11y agoAre official rustc and cargo releases to be expected for running natively on the tier2 platforms (e.g. official rustc for Linux on ARMv7 that targets Linux on ARMv7)?
- steveklabnik 11y agoExact platform support, including "cross compile only" or "rustc/cargo runs on it" are listed here: https://doc.rust-lang.org/book/getting-started.html#platform-support https://doc.rust-lang.org/book/getting-started.html#platform...
- kibwen 11y agoIt's probably not out of the question, though are there a lot of people out there who want to actually develop on e.g. Android rather than just targeting it?
- viperscape 11y agoThe last time I checked android compiling looked very complicated, tons of steps, tool chain setup for Windows. I hope one day it's as simple as flagging the build for the specified architecture.
- crzwdjk 11y agoMy laptop is armv7 linux, and not being able to run rustc on it has been annoying. Well, I did find some binary of some old version somewhere, but it's of limited usefulness since it's old, and it didn't come with cargo, which also wants to bootstrap itself from a native binary. The last time I tried it, I couldn't even cross-compile an ARM rustc from x86_64, because the build scripts wanted to run the binary they were building. This is literally the only reason I've been using C and not Rust (which would have been a much more suitable language) for my latest project. EDIT: Huh. I guess they do have binaries for arm linux now, at least for nightly and beta versions, as of literally two days ago.
- hsivonen 11y agoMaybe not on Android but on GNU/Linux on something other than x86/x86_64 sure.
- naasking 11y agoLooks cool. Will it support targeting Windows from Linux and vice versa?
- Perceptes 11y agorustc/cargo support any target for which a Rust stdlib is distributed, but you are left on your own to install and manage other software which will be needed to do the compilation such as a C cross-compiler for the target, etc. This is much more troublesome for some combinations of host/target than others. Personally, I have yet to get OS X --> Linux working, but Linux/glibc --> Linux/musl was pretty easy.