Installing rustc on PowerPC architecture


Hi, I’m looking to build and install rustc to run on a PowerPC architecture, but I’m running into a problem of not having any snapshots available for me. Is there any way I can use a different machine to bootstrap using one that’s built for cross-compiling to powerpc? Everything goes fine until I need to find a snapshot for it:

$ ./configure && make
cfg: version 1.6.0-dev (9c2489be0 2015-11-01)
cfg: build triple powerpc-unknown-linux-gnu
cfg: host triples powerpc-unknown-linux-gnu
cfg: target triples powerpc-unknown-linux-gnu
cfg: host for powerpc-unknown-linux-gnu is powerpc
cfg: os for powerpc-unknown-linux-gnu is unknown-linux-gnu
cfg: good valgrind for powerpc-unknown-linux-gnu is 1
cfg: using CC=gcc (CFG_CC)
cfg: disabling valgrind run-pass tests
fetch: powerpc-unknown-linux-gnu/stage0/bin/rustc
Traceback (most recent call last):
  File "/home/pavel/Software/rust/src/etc/", line 78, in <module>
  File "/home/pavel/Software/rust/src/etc/", line 60, in main
    snap = determine_curr_snapshot(triple)
  File "/home/pavel/Software/rust/src/etc/", line 301, in determine_curr_snapshot
    (platform, rev))
Exception: no snapshot file found for platform linux-powerpc, rev 7b95b5c
make: *** [powerpc-unknown-linux-gnu/stage0/bin/rustc] Error 1

Any idea what I can do here?

Porting Rust to IBM Power8 platform

I couldn’t get it working, but ostensibly you just clone the Rust source onto a supported machine (e.g. x86[-64] Linux) and build a cross-compiler with:

$ ./configure --target=powerpc-unknown-linux-gnu
$ make

When I tried it, the stage0 compile failed with a bunch of Rust typechecking errors in libcore, for some stupid reason. Also, it seems like the --enable-local-rust flag does nothing, because it still started from scratch with building LLVM.

This is an interesting problem, though. I might bug some of the guys on IRC tomorrow to see why this doesn’t work.


If there’s no powerpc stage0 snapshot or any previously built rustc binary (which wouldn’t help anyway if it wasn’t the same revision as the official stage0) the --enable-local-rust flag is going to be useless by definition.

Skipping the llvm building stage is achieved with --llvm-root flag.

Also, what about the std crate for the powerpc architecture?


If there’s no powerpc stage0 snapshot or any previously built rustc binary (which wouldn’t help anyway if it wasn’t the same revision as the official stage0) the --enable-local-rust flag is going to be useless by definition.

This didn’t seem to work even with using the version of the Rust source checked out from the commit hash in rustc -V. I guess building LLVM is inevitable either way because you need it for the new target, but it was the build failures in libcore that bothered me.

It was a bunch of typechecking errors that would make sense if I was trying to build a libcore of a completely different version of Rust from the compiler. But even starting from stage0 with a snapshot (which bootstraps on the host target triple first, it seems) I still got those errors.

Also, what about the std crate for the powerpc architecture?

It looks like OP is using a Linux target so all the OS-specific stuff should still be supported. A quick search shows pretty good PowerPC support in the arch-specific stuff, which is mostly just activating special behavior for iOS or Windows-MSVC.


Hm, I tried the configure and make steps with the specified cross-compiling target on OS X, and it gets as far as stage2 before dying with the following error:

make/platform/ *** "unable to infer compiler target triple for powerpc-linux-gnu-clang".  Stop.
make: *** [powerpc-unknown-linux-gnu/rt/libcompiler-rt.a] Error 2

I haven’t been able to properly try compiling rust on a separate platform yet, but hopefully this is still doable??


I just tried compiling Rust on a dual-core embedded powerpc64 based SoC processor (Freescale/NXP), and ran into the same situation. I’d like to offer remote access to my machine, for anyone interested in working on this. LLVM itself supports powerpc64 just fine.


Is there a supported target for your platform? What’s the target triple called?

I think until cross-compilation story gets better you should probably ask for an unofficial, manually downloadable stage0 snapshot. Maybe someone will oblige :slight_smile:

The devs could easily do it but there’s always the problem of needing a separate snapshot for every OS so they’d soon start getting many different cpu/os requests.


The target triple defined in the rust source is powerpc-unknown-linux-gnu, but there is no snapshot for it.

Cross compile target i386 architecture

Obviously not or you would be downloading rust from the official site. :slight_smile:

The situation is similar to ARM Linux support (not a tier-1 platform either) where the stage0 snapshots were cross-compiled by @japaric and made available for download. You should study his project’s page first (the amd64 part) and try replicating the cross-compilation procedure for your own architecture.

Unless you’re going to cross-compile (cross-bootstrap) each time, I’d suggest checking out the necessary revision and building a stage0 equivalent right away:

git clone --recursive
cd rust
git reset --hard 1af31d4

Followed by the steps from the script. This way you’ll gain the ability to build rust natively on you powerPC.

EDIT 2015-12-23
There’s a new stage0 snapshot @commit 3391630



I’ve successfully built rustc such that it works on my PowerPC linux machine! Thanks for pointing me to the project page for arm. It was not straightforward (there are a few differences between the build system now and the build system a year ago) but I got it working!

Is there a way I can add these snapshots to the official rust ones such that others can just download them automagically?


You should definitely document the required changes and upload your build to some file sharing service. Uploading a stage0 snapshot and a cargo binary would allow anyone to bootstrap everything themselves natively.


OK, I’ll do that and post the links back here.

Unfortunately, I think I have to wait for the Cargo and its dependencies to update to libc 0.2.5 to integrate my PowerPC support, so there’s no cargo binary yet.


Is there a problem building cargo?


There are a few projects for which I have patches to get PowerPC support working. I’m waiting to make sure that I’ve gotten all of the components of the toolchain right before pushing them upstream and posting the results here. :slightly_smiling: