Building rustc on unsupported platforms (alternative method to cross-bootstrapping)


It seems that qemu-user has improved to the point of being able to handle all crates’ compilations during the bootstrap process. This means, for instance, people on OpenPandora or PowerPC Linux should be able to build their rustc natively using a stage0 snapshot from a different, emulated platform as long as qemu-user is available.

I’d described the way to do it on OpenPandora here.

Using the native gcc toolchain it’s possible to do just the regular:

./configure --enable-local-rust --local-rust-root=/tmp/stage0/ --target=your-target-triple

and if there’s llvm 3.6 or newer installed on your platform it gets even faster with an additional --llvm-root= switch.

Setting up a qemu userspace environment entails copying and symlinking ld, libc, libdl, libpthread, libm, librt, libgcc from the emulated architecture to the host system. Shouldn’t prove too hard to google in case:

qemu-x86_64 /tmp/stage0/rustc.bin were still to complain about missing libs.

(just an example using x86_64 snapshot, etc).

Obviously, once stage0 is over it’s back to your own platform’s native speed. I did a successful test a few days ago using qemu-i386 and also built libcore for x86 using qemu-x86_64 so it’s probably safe to say it might work everywhere.

How Can i create android application using rust?
Installing rustc on PowerPC architecture